original_string: public function compose($single = false)
      {
          $reflection = new \ReflectionClass($this->class);
  
          $constructArgs  = $this->constructArgs;
          $methodArgs     = $this->methodArgs;
  
          if ($single) {
              static $obj;
              if ($obj == null) {
                  $obj = (new Asset($this->class))->single(
                      function () use ($reflection, $constructArgs, $methodArgs) {
                          if ($constructArgs) {
                              $object = $reflection->newInstanceArgs($constructArgs);
                          } else {
                              $object = $reflection->newInstance();
                          }
  
                          foreach ($methodArgs as $method => $params) {
                              if ($reflection->hasMethod($method)) {
                                  call_user_func_array([$object, $method], $params);
                              }
                          }
                          return $object;
                      }
                  );
              }
              return $obj;
          } else {
              return new Asset(
                  $this->class,
                  function () use ($reflection, $constructArgs, $methodArgs) {
                      if ($constructArgs) {
                          $object = $reflection->newInstanceArgs($constructArgs);
                      } else {
                          $object = $reflection->newInstance();
                      }
  
                      foreach ($methodArgs as $method => $params) {
                          if ($reflection->hasMethod($method)) {
                              call_user_func_array([$object, $method], $params);
                          }
                      }
                      return $object;
                  }
              );
          }
      }
code: public function compose($single = false)
      {
          $reflection = new \ReflectionClass($this->class);
  
          $constructArgs  = $this->constructArgs;
          $methodArgs     = $this->methodArgs;
  
          if ($single) {
              static $obj;
              if ($obj == null) {
                  $obj = (new Asset($this->class))->single(
                      function () use ($reflection, $constructArgs, $methodArgs) {
                          if ($constructArgs) {
                              $object = $reflection->newInstanceArgs($constructArgs);
                          } else {
                              $object = $reflection->newInstance();
                          }
  
                          foreach ($methodArgs as $method => $params) {
                              if ($reflection->hasMethod($method)) {
                                  call_user_func_array([$object, $method], $params);
                              }
                          }
                          return $object;
                      }
                  );
              }
              return $obj;
          } else {
              return new Asset(
                  $this->class,
                  function () use ($reflection, $constructArgs, $methodArgs) {
                      if ($constructArgs) {
                          $object = $reflection->newInstanceArgs($constructArgs);
                      } else {
                          $object = $reflection->newInstance();
                      }
  
                      foreach ($methodArgs as $method => $params) {
                          if ($reflection->hasMethod($method)) {
                              call_user_func_array([$object, $method], $params);
                          }
                      }
                      return $object;
                  }
              );
          }
      }
code_tokens: public function compose ( $ single = false ) { $ reflection = new \ ReflectionClass ( $ this -> class ) ; $ constructArgs = $ this -> constructArgs ; $ methodArgs = $ this -> methodArgs ; if ( $ single ) { static $ obj ; if ( $ obj == null ) { $ obj = ( new Asset ( $ this -> class ) ) -> single ( function ( ) use ( $ reflection , $ constructArgs , $ methodArgs ) { if ( $ constructArgs ) { $ object = $ reflection -> newInstanceArgs ( $ constructArgs ) ; } else { $ object = $ reflection -> newInstance ( ) ; } foreach ( $ methodArgs as $ method => $ params ) { if ( $ reflection -> hasMethod ( $ method ) ) { call_user_func_array ( [ $ object , $ method ] , $ params ) ; } } return $ object ; } ) ; } return $ obj ; } else { return new Asset ( $ this -> class , function ( ) use ( $ reflection , $ constructArgs , $ methodArgs ) { if ( $ constructArgs ) { $ object = $ reflection -> newInstanceArgs ( $ constructArgs ) ; } else { $ object = $ reflection -> newInstance ( ) ; } foreach ( $ methodArgs as $ method => $ params ) { if ( $ reflection -> hasMethod ( $ method ) ) { call_user_func_array ( [ $ object , $ method ] , $ params ) ; } } return $ object ; } ) ; } }
docstring: Build a configured Asset and return it.
  
  This Asset can optionally be returned implementing a singleton.
  
  @param bool $single
  @return Proem\Service\AssetInterface
docstring_tokens: Build a configured Asset and return it .