private - nested classes php or other method

142

I am looking for a method like the suggested php >=5.6 nested classes.

example

class Parent {

   public function call(){
       return new $this->Child;
   }

    class Child {

    }

}

Basically what I'm looking to do is something like

Secure::Encryption::Get();

or

Secure::Encryption($type)::Get();

You can do something similar in JavaScript ex:

function Secure(){

     return {
   Encryption: function(){
             return:{
                 Get:function(){}
             }
        }
     }
}

I want to have private members only accesible to theEncryption member. I know that nested classes are not possible yet so I'm looking for an alternative

People are also looking for solutions to the problem: php - CakePHP Posting Error

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.