public function applyDefaults($definition)
    {
        if (!is_array($definition) || !isset($definition['component'])) {
            return $definition;
        }

        if (is_callable($definition['component'])) {
            return array_merge($this->callableDefaults, $definition);
        }

        if (!isset($definition['component']['class'])) {
            throw new AppException('Missing required "class" key in component definition');
        }

        $definition = array_merge_recursive($this->classDefaults, $definition);

        array_walk(
            $definition['component']['calls'],
            function (&$call) {
                $call = (array) $call;
            }
        );

        return $definition;
    }
public function applyDefaults($definition)
    {
        if (!is_array($definition) || !isset($definition['component'])) {
            return $definition;
        }

        if (is_callable($definition['component'])) {
            return array_merge($this->callableDefaults, $definition);
        }

        if (!isset($definition['component']['class'])) {
            throw new AppException('Missing required "class" key in component definition');
        }

        $definition = array_merge_recursive($this->classDefaults, $definition);

        array_walk(
            $definition['component']['calls'],
            function (&$call) {
                $call = (array) $call;
            }
        );

        return $definition;
    }
public function applyDefaults ( $ definition ) { if ( ! is_array ( $ definition ) || ! isset ( $ definition [ 'component' ] ) ) { return $ definition ; } if ( is_callable ( $ definition [ 'component' ] ) ) { return array_merge ( $ this -> callableDefaults , $ definition ) ; } if ( ! isset ( $ definition [ 'component' ] [ 'class' ] ) ) { throw new AppException ( 'Missing required "class" key in component definition' ) ; } $ definition = array_merge_recursive ( $ this -> classDefaults , $ definition ) ; array_walk ( $ definition [ 'component' ] [ 'calls' ] , function ( & $ call ) { $ call = ( array ) $ call ; } ) ; return $ definition ; }
Applies default values or missing properties to component definition

@param array|callable $definition

@return array
@throws AppException
Applies default values or missing properties to component definition