original_string: public static function call($method, $args, $content_type = null)
      {
          if (count($args) == 0) {
              throw new Exception\InvalidArgsException("You need specify at least the URL to call");
          }
  
          $method    = strtoupper($method);
          $url       = null;
          $params    = null;
          $callback  = null;
          $data_type = '';
          
          if (!is_string($args[0]) || !filter_var($args[0], FILTER_VALIDATE_URL)) {
              throw new Exception\InvalidArgsException("The URL you specified is not valid.");
          } else {
              $url = \array_shift($args);
          }
  
          //Is there any parameters to add?
          if (count($args) > 0 && is_array($args[0])) {
              $params = \array_shift($args);
          }
          
          //Is there any callback function to call?
          if (count($args) > 0 && is_callable($args[0])) {
              $callback = \array_shift($args);
          }
          
          //Is there any data type?
          if (count($args) > 0 && is_string($args[0])) {
              $data_type = \array_shift($args);
          }
          //END of arguments treatment
  
          if ($method == 'POST' && $content_type == 'json') {
              $data = self::curl($method, $url, \reset($params), array(
                  CURLOPT_HTTPHEADER     => array('Content-Type: application/json'),
                  CURLOPT_POSTFIELDS     => $params,
              ));
  
          } else if ($method == 'POST' && $content_type == 'xml') {
              $data = self::curl($method, $url, \reset($params), array(
                  CURLOPT_HTTPHEADER     => array('Content-Type: text/xml'),
                  CURLOPT_POSTFIELDS     => $params,
              ));
  
          } else {
              $data = self::curl($method, $url, $params);
          }
  
          $data = StringParser::parse($data, $data_type);
  
          if (!is_null($callback)) {
              $data = $callback($data);
          }
  
          return $data;
      }
code: public static function call($method, $args, $content_type = null)
      {
          if (count($args) == 0) {
              throw new Exception\InvalidArgsException("You need specify at least the URL to call");
          }
  
          $method    = strtoupper($method);
          $url       = null;
          $params    = null;
          $callback  = null;
          $data_type = '';
          
          if (!is_string($args[0]) || !filter_var($args[0], FILTER_VALIDATE_URL)) {
              throw new Exception\InvalidArgsException("The URL you specified is not valid.");
          } else {
              $url = \array_shift($args);
          }
  
          //Is there any parameters to add?
          if (count($args) > 0 && is_array($args[0])) {
              $params = \array_shift($args);
          }
          
          //Is there any callback function to call?
          if (count($args) > 0 && is_callable($args[0])) {
              $callback = \array_shift($args);
          }
          
          //Is there any data type?
          if (count($args) > 0 && is_string($args[0])) {
              $data_type = \array_shift($args);
          }
          //END of arguments treatment
  
          if ($method == 'POST' && $content_type == 'json') {
              $data = self::curl($method, $url, \reset($params), array(
                  CURLOPT_HTTPHEADER     => array('Content-Type: application/json'),
                  CURLOPT_POSTFIELDS     => $params,
              ));
  
          } else if ($method == 'POST' && $content_type == 'xml') {
              $data = self::curl($method, $url, \reset($params), array(
                  CURLOPT_HTTPHEADER     => array('Content-Type: text/xml'),
                  CURLOPT_POSTFIELDS     => $params,
              ));
  
          } else {
              $data = self::curl($method, $url, $params);
          }
  
          $data = StringParser::parse($data, $data_type);
  
          if (!is_null($callback)) {
              $data = $callback($data);
          }
  
          return $data;
      }
code_tokens: public static function call ( $ method , $ args , $ content_type = null ) { if ( count ( $ args ) == 0 ) { throw new Exception \ InvalidArgsException ( "You need specify at least the URL to call" ) ; } $ method = strtoupper ( $ method ) ; $ url = null ; $ params = null ; $ callback = null ; $ data_type = '' ; if ( ! is_string ( $ args [ 0 ] ) || ! filter_var ( $ args [ 0 ] , FILTER_VALIDATE_URL ) ) { throw new Exception \ InvalidArgsException ( "The URL you specified is not valid." ) ; } else { $ url = \ array_shift ( $ args ) ; } //Is there any parameters to add? if ( count ( $ args ) > 0 && is_array ( $ args [ 0 ] ) ) { $ params = \ array_shift ( $ args ) ; } //Is there any callback function to call? if ( count ( $ args ) > 0 && is_callable ( $ args [ 0 ] ) ) { $ callback = \ array_shift ( $ args ) ; } //Is there any data type? if ( count ( $ args ) > 0 && is_string ( $ args [ 0 ] ) ) { $ data_type = \ array_shift ( $ args ) ; } //END of arguments treatment if ( $ method == 'POST' && $ content_type == 'json' ) { $ data = self :: curl ( $ method , $ url , \ reset ( $ params ) , array ( CURLOPT_HTTPHEADER => array ( 'Content-Type: application/json' ) , CURLOPT_POSTFIELDS => $ params , ) ) ; } else if ( $ method == 'POST' && $ content_type == 'xml' ) { $ data = self :: curl ( $ method , $ url , \ reset ( $ params ) , array ( CURLOPT_HTTPHEADER => array ( 'Content-Type: text/xml' ) , CURLOPT_POSTFIELDS => $ params , ) ) ; } else { $ data = self :: curl ( $ method , $ url , $ params ) ; } $ data = StringParser :: parse ( $ data , $ data_type ) ; if ( ! is_null ( $ callback ) ) { $ data = $ callback ( $ data ) ; } return $ data ; }
docstring: Deals with the arguments "detection" and sets the rigth configs for the method you specify
  @param string $method You can use the following: GET, POST, PUT, DELETE
  @param array $args
  @param string $content_type Should be json or xml, if not, just leave it empty
  @return string|array
docstring_tokens: Deals with the arguments detection and sets the rigth configs for the method you specify