src/Factory.php
private static function getServiceOrModel(
        array &$aTrackerArray,
        string $sType,
        string $sName,
        string $sComponent,
        array $aParamaters
    ): object {
        /**
         * We track them like this because we need to return the instance of the
         * item, not the closure. If we don't do this then we will always get
         * a new instance of the item, which is undesireable.
         */

        $sKey = md5($sComponent . $sName);

        if (!array_key_exists($sKey, $aTrackerArray)) {

            $aTrackerArray[$sKey] = call_user_func_array(
                self::getService($sType, $sName, $sComponent),
                $aParamaters
            );

        } elseif (!empty($aParamaters)) {
            trigger_error(
                'A call to Factory::' . $sType . '(' . $sName . ') passed construction paramaters, but the object has already been constructed'
            );
        }

        return $aTrackerArray[$sKey];
    }
private static function getServiceOrModel(
        array &$aTrackerArray,
        string $sType,
        string $sName,
        string $sComponent,
        array $aParamaters
    ): object {
        /**
         * We track them like this because we need to return the instance of the
         * item, not the closure. If we don't do this then we will always get
         * a new instance of the item, which is undesireable.
         */

        $sKey = md5($sComponent . $sName);

        if (!array_key_exists($sKey, $aTrackerArray)) {

            $aTrackerArray[$sKey] = call_user_func_array(
                self::getService($sType, $sName, $sComponent),
                $aParamaters
            );

        } elseif (!empty($aParamaters)) {
            trigger_error(
                'A call to Factory::' . $sType . '(' . $sName . ') passed construction paramaters, but the object has already been constructed'
            );
        }

        return $aTrackerArray[$sKey];
    }
private static function getServiceOrModel ( array & $ aTrackerArray , string $ sType , string $ sName , string $ sComponent , array $ aParamaters ) : object { /**
         * We track them like this because we need to return the instance of the
         * item, not the closure. If we don't do this then we will always get
         * a new instance of the item, which is undesireable.
         */ $ sKey = md5 ( $ sComponent . $ sName ) ; if ( ! array_key_exists ( $ sKey , $ aTrackerArray ) ) { $ aTrackerArray [ $ sKey ] = call_user_func_array ( self :: getService ( $ sType , $ sName , $ sComponent ) , $ aParamaters ) ; } elseif ( ! empty ( $ aParamaters ) ) { trigger_error ( 'A call to Factory::' . $ sType . '(' . $ sName . ') passed construction paramaters, but the object has already been constructed' ) ; } return $ aTrackerArray [ $ sKey ] ; }
Loads a servie or a model from the tracker array

@param array  $aTrackerArray The tracker array to load from
@param string $sType         The type of item being loaded
@param string $sName         The name of the item being loaded
@param string $sComponent    The name of the component which provides the item
@param array  $aParamaters   Any paramters to pass to the constructor

@return object
@throws FactoryException
Loads a servie or a model from the tracker array