src/PeskyCMF/Config/ConfigsContainer.php
public function toArray() {
        if ($this->array === null) {
            $this->array = [];
            $reflection = new \ReflectionClass($this);
            /*
             * You may ask why haven't I used \ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC here.
             * The answer is: it is not working in php 5.6.12 or maybe in other versions too
             */
            $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
            foreach ($methods as $method) {
                if (
                    $method->isPublic()
                    && $method->getNumberOfParameters() === 0
                    && $method->getName() !== 'getInstance'
                ) {
                    $this->array[$method->getName()] = $method->invoke(null);
                }
            }
            $this->array['config_instance'] = $this;
        }
        return $this->array;
    }
public function toArray() {
        if ($this->array === null) {
            $this->array = [];
            $reflection = new \ReflectionClass($this);
            /*
             * You may ask why haven't I used \ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC here.
             * The answer is: it is not working in php 5.6.12 or maybe in other versions too
             */
            $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
            foreach ($methods as $method) {
                if (
                    $method->isPublic()
                    && $method->getNumberOfParameters() === 0
                    && $method->getName() !== 'getInstance'
                ) {
                    $this->array[$method->getName()] = $method->invoke(null);
                }
            }
            $this->array['config_instance'] = $this;
        }
        return $this->array;
    }
public function toArray ( ) { if ( $ this -> array === null ) { $ this -> array = [ ] ; $ reflection = new \ ReflectionClass ( $ this ) ; /*
             * You may ask why haven't I used \ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC here.
             * The answer is: it is not working in php 5.6.12 or maybe in other versions too
             */ $ methods = $ reflection -> getMethods ( \ ReflectionMethod :: IS_STATIC ) ; foreach ( $ methods as $ method ) { if ( $ method -> isPublic ( ) && $ method -> getNumberOfParameters ( ) === 0 && $ method -> getName ( ) !== 'getInstance' ) { $ this -> array [ $ method -> getName ( ) ] = $ method -> invoke ( null ) ; } } $ this -> array [ 'config_instance' ] = $ this ; } return $ this -> array ; }
Get the instance as an array.
Note 1: it collects returns from all "static public" methods that do not have parameters
Collecting done only once. There should be no need to do it more then once.
Note 2: array does not contain key "getInstance" but contains key "config_instance" instead
@return array
Get the instance as an array . Note 1 : it collects returns from all static public methods that do not have parameters Collecting done only once . There should be no need to do it more then once . Note 2 : array does not contain key getInstance but contains key config_instance instead