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

  • SEARCH
  • Home
  • 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

Situation: Site with content protected by username/password (not all controlled since they can be
The situation is as follows: I've got 2 models: 'Action' and 'User'. These models
Our situation is as follows, but I'm curious about this problem in any situation.
The situation is as follows: A series of remote workstations collect field data and
Situation: I have a simple XML document that contains image information. I need to
Situation: text: a string R: a regex that matches part of the string. This
Situation: you've got a .swf embedded in an html page, and when you click
The situation: I have a pieceofcrapuous laptop. One of the things that make it
I have a problem with Lucene 2.4, the situation being as follows: I have
Situation: A PHP application with multiple installable modules creates a new table in database

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.