Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6128439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:37:38+00:00 2026-05-23T16:37:38+00:00

Situation is as follows: There is a separate object that is responsible for generating

  • 0

Situation is as follows:

There is a separate object that is responsible for generating page content, we can call it Content. Another object is its’ parent – Core object.
Content object calls Core method *Check_parameters_count($parameters_count)*, so Core has to check if given parameters count in the URI equals to the integer given while executing this method ($parameters_count), if not – Core should generate error page and stop executing Content’s rendering method.

Is there any way I can do this without using if statement? Just using *$core->Check_parameters_count(2)* in the content class in order to simplify job of the specific rendering engine programmers.

Everything should look similar to this:

 class Core {
    public function Check_parameters_count($parameters_count) {
        if (count($this->parameters) != $parameters_count) {
            $this->Show_error(404);
            $this->Stop_executing($content, 'Render');
            //or
            stop($content->Render);
            //or something similar..
        }
    }
}

class Content {
    public function Render() {
        //check given parameters so we could know which page should be rendered and how many parameters should be given
        //...
        //lets say we should have exactly 2 parameters
        $parameters_count = 2;
        //check it
        $core->Check_parameters_count($parameters_count);
        //if parameters count matched - continue method execution
        //...
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:37:38+00:00Added an answer on May 23, 2026 at 4:37 pm

    Throw an exception.

    You have 3 scopes:

    • Function A (caller of function B)
    • Function B
    • Caller of function A

    If you throw an exception in Function B, and make a try/catch block in caller of function A, function A execution will be interrupted by the exception. In fact – all code execution will be interrupted, up to a level which is enclosed in a corresponding try/catch block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My situation is a follows: There is some class MyList that will probably get
The situation is as follows: there's a website that connects sellers and buyers, like
We have an application that was built using .NET 3.5. There is a situation
So I have a situation where there is an ajax call made after a
I have a situation as follows <body> Test<br /> test<br /> test1<br /> </body>
My situation is as follows: I'm working on an implementation of BlackJack. I've got
Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text
Situation: I have some persons with certain skills and they can/might belong to more
Situation: I want to provide a website service where users can enter some data
Situation: A custom Master Document content type inherits from Document The Master Document content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.