src/Wrapper.php
public function authorize($args)
  {
      $numArgs = func_num_args();

      if ($numArgs === 0) {
          throw new \InvalidArgumentException('Wrapper->authorize expects atleast 1 argument!');

          return;
      }

      if ($numArgs === 1) {
          $arg1 = func_get_arg(0);
          if ($arg1 instanceof OAuthResponse) {
              $this->accessToken = $arg1->getAccessToken();
              $this->registeredScopes = $arg1->getScope();
          } elseif (is_string($arg1)) {
              $this->accessToken = $arg1;
          } else {
              throw new \InvalidArgumentException("Passed argument must be an access token OR an instance of Raideer\TwitchApi\OAuthResponse");

              return;
          }
      } elseif ($numArgs === 2) {
          list($arg1, $arg2) = func_get_args();

          if (is_string($arg1) && is_array($arg2)) {
              $this->accessToken = $arg1;
              $this->registeredScopes = $arg2;
          } else {
              throw new \InvalidArgumentException('First argument must be an accessToken and the second must be an array of registered scopes');

              return;
          }
      } else {
          throw new \InvalidArgumentException('Wrapper->authorize expects 1 or 2 arguments');

          return;
      }

      $this->authorized = true;
  }
public function authorize($args)
  {
      $numArgs = func_num_args();

      if ($numArgs === 0) {
          throw new \InvalidArgumentException('Wrapper->authorize expects atleast 1 argument!');

          return;
      }

      if ($numArgs === 1) {
          $arg1 = func_get_arg(0);
          if ($arg1 instanceof OAuthResponse) {
              $this->accessToken = $arg1->getAccessToken();
              $this->registeredScopes = $arg1->getScope();
          } elseif (is_string($arg1)) {
              $this->accessToken = $arg1;
          } else {
              throw new \InvalidArgumentException("Passed argument must be an access token OR an instance of Raideer\TwitchApi\OAuthResponse");

              return;
          }
      } elseif ($numArgs === 2) {
          list($arg1, $arg2) = func_get_args();

          if (is_string($arg1) && is_array($arg2)) {
              $this->accessToken = $arg1;
              $this->registeredScopes = $arg2;
          } else {
              throw new \InvalidArgumentException('First argument must be an accessToken and the second must be an array of registered scopes');

              return;
          }
      } else {
          throw new \InvalidArgumentException('Wrapper->authorize expects 1 or 2 arguments');

          return;
      }

      $this->authorized = true;
  }
public function authorize ( $ args ) { $ numArgs = func_num_args ( ) ; if ( $ numArgs === 0 ) { throw new \ InvalidArgumentException ( 'Wrapper->authorize expects atleast 1 argument!' ) ; return ; } if ( $ numArgs === 1 ) { $ arg1 = func_get_arg ( 0 ) ; if ( $ arg1 instanceof OAuthResponse ) { $ this -> accessToken = $ arg1 -> getAccessToken ( ) ; $ this -> registeredScopes = $ arg1 -> getScope ( ) ; } elseif ( is_string ( $ arg1 ) ) { $ this -> accessToken = $ arg1 ; } else { throw new \ InvalidArgumentException ( "Passed argument must be an access token OR an instance of Raideer\TwitchApi\OAuthResponse" ) ; return ; } } elseif ( $ numArgs === 2 ) { list ( $ arg1 , $ arg2 ) = func_get_args ( ) ; if ( is_string ( $ arg1 ) && is_array ( $ arg2 ) ) { $ this -> accessToken = $ arg1 ; $ this -> registeredScopes = $ arg2 ; } else { throw new \ InvalidArgumentException ( 'First argument must be an accessToken and the second must be an array of registered scopes' ) ; return ; } } else { throw new \ InvalidArgumentException ( 'Wrapper->authorize expects 1 or 2 arguments' ) ; return ; } $ this -> authorized = true ; }
Enables the authorized requests.

@param  string $args Access token
OR
@param  OAuthResponse $args Object returned by OAuth->getResponse()
OR
@param string $arg1 Access Token
@param array $arg2 Array of registered scopes

@return void
Enables the authorized requests .