public function _init($data, $depends, $loads, $schema, $extras=null) {
      $plain = $data->get();      
      $input_is_str = $data->is_string();
      $double_string = $data->is_double_string();
      /*
       * replace all numerical keys with the ones defined in schema    
       *
       * this is to support backwards compatilbility and 
       * add trivial loading for certain objects.
       *
       * i.e 
       * Gather('call_id', array(params))
       * same as
       * Gather(array('call_id' => '', params))
       */

      /** don't overload a 'GET' which is '1' in arity. This can be 2+ **/
      if (sizeof($plain) > 1 && !$double_string) {
        foreach ($plain as $k => $p) {
          if (is_numeric($k) && isset($loads->init[$k])) {
            $plain[$loads->init[$k]] = $p;
            unset($plain[$k]);
          }
        }
      }
      /**
       * another backwards compatable thing 
       * arguments were passed as singular and
       * id being intialized is the parent's
       * so it should be:
       * Gather('call_id')
       * and not:
       * Gather('gather_id')
       *
       * other resources, i.e calls would not need there
       * conference id to be initialized thus can be called normally
       * 
       * 
       * this is only for models that use other models.
       * without their main resource's id they cannot
       * do anything.
       */
      if ($input_is_str && $loads->silent && !$double_string) {
        $plain = array($loads->init[0] => $plain);
      }


      /**
      * two based arguments
      * Gather('call_id', 'gather_id')
       * 
      * this is for resources that need there parent
      * resource to operate
      */
      if ($double_string) {
        $plain = array($loads->init[0] => $plain[0], "id" => $plain[1]);
      }


      $pargs = func_get_args();

      /** string endpoint has been added in params **/
      $cl = preg_replace("/^Catapult\\\/", "", get_class($this));

      $bpath = self::$paths[$cl]; 


      $sets = array(
       "depends" => $depends, "loads" => $loads, "schema" => $schema, "path", $bpath
      );


      foreach ($sets as $k => $s) 
          $this->$k = $s;
      $this->path = $bpath; 

      $this->subfunctions = $extras;    

      /** attach the main client to this object **/
      ClientResource::attach($this);

      /** use depends **/
      PathResource::make($this, $plain);

      /** use schema **/
      VerifyResource::verify($this, $plain);

      /** attach functions **/
      //FunctionResource::register($extras);

      Resolver::find($this, $plain);

      /** dispose these resources they can take some space **/
      /** we only need the client now **/
      foreach ($sets as $k => $s) 
        unset($this->$k);

    }
public function _init($data, $depends, $loads, $schema, $extras=null) {
      $plain = $data->get();      
      $input_is_str = $data->is_string();
      $double_string = $data->is_double_string();
      /*
       * replace all numerical keys with the ones defined in schema    
       *
       * this is to support backwards compatilbility and 
       * add trivial loading for certain objects.
       *
       * i.e 
       * Gather('call_id', array(params))
       * same as
       * Gather(array('call_id' => '', params))
       */

      /** don't overload a 'GET' which is '1' in arity. This can be 2+ **/
      if (sizeof($plain) > 1 && !$double_string) {
        foreach ($plain as $k => $p) {
          if (is_numeric($k) && isset($loads->init[$k])) {
            $plain[$loads->init[$k]] = $p;
            unset($plain[$k]);
          }
        }
      }
      /**
       * another backwards compatable thing 
       * arguments were passed as singular and
       * id being intialized is the parent's
       * so it should be:
       * Gather('call_id')
       * and not:
       * Gather('gather_id')
       *
       * other resources, i.e calls would not need there
       * conference id to be initialized thus can be called normally
       * 
       * 
       * this is only for models that use other models.
       * without their main resource's id they cannot
       * do anything.
       */
      if ($input_is_str && $loads->silent && !$double_string) {
        $plain = array($loads->init[0] => $plain);
      }


      /**
      * two based arguments
      * Gather('call_id', 'gather_id')
       * 
      * this is for resources that need there parent
      * resource to operate
      */
      if ($double_string) {
        $plain = array($loads->init[0] => $plain[0], "id" => $plain[1]);
      }


      $pargs = func_get_args();

      /** string endpoint has been added in params **/
      $cl = preg_replace("/^Catapult\\\/", "", get_class($this));

      $bpath = self::$paths[$cl]; 


      $sets = array(
       "depends" => $depends, "loads" => $loads, "schema" => $schema, "path", $bpath
      );


      foreach ($sets as $k => $s) 
          $this->$k = $s;
      $this->path = $bpath; 

      $this->subfunctions = $extras;    

      /** attach the main client to this object **/
      ClientResource::attach($this);

      /** use depends **/
      PathResource::make($this, $plain);

      /** use schema **/
      VerifyResource::verify($this, $plain);

      /** attach functions **/
      //FunctionResource::register($extras);

      Resolver::find($this, $plain);

      /** dispose these resources they can take some space **/
      /** we only need the client now **/
      foreach ($sets as $k => $s) 
        unset($this->$k);

    }
public function _init ( $ data , $ depends , $ loads , $ schema , $ extras = null ) { $ plain = $ data -> get ( ) ; $ input_is_str = $ data -> is_string ( ) ; $ double_string = $ data -> is_double_string ( ) ; /*
       * replace all numerical keys with the ones defined in schema    
       *
       * this is to support backwards compatilbility and 
       * add trivial loading for certain objects.
       *
       * i.e 
       * Gather('call_id', array(params))
       * same as
       * Gather(array('call_id' => '', params))
       */ /** don't overload a 'GET' which is '1' in arity. This can be 2+ **/ if ( sizeof ( $ plain ) > 1 && ! $ double_string ) { foreach ( $ plain as $ k => $ p ) { if ( is_numeric ( $ k ) && isset ( $ loads -> init [ $ k ] ) ) { $ plain [ $ loads -> init [ $ k ] ] = $ p ; unset ( $ plain [ $ k ] ) ; } } } /**
       * another backwards compatable thing 
       * arguments were passed as singular and
       * id being intialized is the parent's
       * so it should be:
       * Gather('call_id')
       * and not:
       * Gather('gather_id')
       *
       * other resources, i.e calls would not need there
       * conference id to be initialized thus can be called normally
       * 
       * 
       * this is only for models that use other models.
       * without their main resource's id they cannot
       * do anything.
       */ if ( $ input_is_str && $ loads -> silent && ! $ double_string ) { $ plain = array ( $ loads -> init [ 0 ] => $ plain ) ; } /**
      * two based arguments
      * Gather('call_id', 'gather_id')
       * 
      * this is for resources that need there parent
      * resource to operate
      */ if ( $ double_string ) { $ plain = array ( $ loads -> init [ 0 ] => $ plain [ 0 ] , "id" => $ plain [ 1 ] ) ; } $ pargs = func_get_args ( ) ; /** string endpoint has been added in params **/ $ cl = preg_replace ( "/^Catapult\\\/" , "" , get_class ( $ this ) ) ; $ bpath = self :: $ paths [ $ cl ] ; $ sets = array ( "depends" => $ depends , "loads" => $ loads , "schema" => $ schema , "path" , $ bpath ) ; foreach ( $ sets as $ k => $ s ) $ this -> $ k = $ s ; $ this -> path = $ bpath ; $ this -> subfunctions = $ extras ; /** attach the main client to this object **/ ClientResource :: attach ( $ this ) ; /** use depends **/ PathResource :: make ( $ this , $ plain ) ; /** use schema **/ VerifyResource :: verify ( $ this , $ plain ) ; /** attach functions **/ //FunctionResource::register($extras); Resolver :: find ( $ this , $ plain ) ; /** dispose these resources they can take some space **/ /** we only need the client now **/ foreach ( $ sets as $ k => $ s ) unset ( $ this -> $ k ) ; }
_init performs basic
functions to set up all
the subclasses. Will call the
normal execution order.

- first attach the client
- check if the schema is properly formed
- initialize path with dependancies
- return the appropriate object use in resolver
added: 1/29/2015
_init performs basic functions to set up all the subclasses . Will call the normal execution order .