src/xAC/MagicFactoryTrait.php
public static function __callstatic($name, $arguments)
    {
        // Get global services or entity services
        $services = Client::getServices(isset($arguments['context']) ? $arguments['context'] : null);
    
        if (array_key_exists($name, $services)) {
            $service = $services[$name];

            switch ($service['type']) {
    
                case 'collection':
                    return new Cursor(
                        $service, 
                        Client::getInstance(), 
                        isset($arguments['context']) ? $arguments['context'] : null
                    );
                    break;
    
                case 'entity':
                    return new Entity(
                        $service, 
                        Client::getInstance(), 
                        isset($arguments[0]) ? $arguments[0] : null
                    );
                    break;
                
                // $name represents an action on an entity
                case 'action':
                    return new Action(
                        $service,
                        $arguments['context'],
                        Client::getInstance()
                    );
                    break;
    
                default:
                    throw new \Exception("Don't know of any service type named '$name'");
                    break;
            }
        } else {
            throw new \Exception("can't find service definition for '$name'");
        }
    }
public static function __callstatic($name, $arguments)
    {
        // Get global services or entity services
        $services = Client::getServices(isset($arguments['context']) ? $arguments['context'] : null);
    
        if (array_key_exists($name, $services)) {
            $service = $services[$name];

            switch ($service['type']) {
    
                case 'collection':
                    return new Cursor(
                        $service, 
                        Client::getInstance(), 
                        isset($arguments['context']) ? $arguments['context'] : null
                    );
                    break;
    
                case 'entity':
                    return new Entity(
                        $service, 
                        Client::getInstance(), 
                        isset($arguments[0]) ? $arguments[0] : null
                    );
                    break;
                
                // $name represents an action on an entity
                case 'action':
                    return new Action(
                        $service,
                        $arguments['context'],
                        Client::getInstance()
                    );
                    break;
    
                default:
                    throw new \Exception("Don't know of any service type named '$name'");
                    break;
            }
        } else {
            throw new \Exception("can't find service definition for '$name'");
        }
    }
public static function __callstatic ( $ name , $ arguments ) { // Get global services or entity services $ services = Client :: getServices ( isset ( $ arguments [ 'context' ] ) ? $ arguments [ 'context' ] : null ) ; if ( array_key_exists ( $ name , $ services ) ) { $ service = $ services [ $ name ] ; switch ( $ service [ 'type' ] ) { case 'collection' : return new Cursor ( $ service , Client :: getInstance ( ) , isset ( $ arguments [ 'context' ] ) ? $ arguments [ 'context' ] : null ) ; break ; case 'entity' : return new Entity ( $ service , Client :: getInstance ( ) , isset ( $ arguments [ 0 ] ) ? $ arguments [ 0 ] : null ) ; break ; // $name represents an action on an entity case 'action' : return new Action ( $ service , $ arguments [ 'context' ] , Client :: getInstance ( ) ) ; break ; default : throw new \ Exception ( "Don't know of any service type named '$name'" ) ; break ; } } else { throw new \ Exception ( "can't find service definition for '$name'" ) ; } }
Magic method for static calls
@param string $name
@param array $arguments
@return mixed
Magic method for static calls