original_string: protected static function createNew(
          int $ttl,
          TokenOwnerInterface $owner = null,
          Client $client = null,
          array $scopes = null
      ): self {
          if (is_array($scopes)) {
              $scopes = array_map(function ($scope) {
                  return (string) $scope;
              }, $scopes);
          }
  
          $token = new static();
  
          $token->token = bin2hex(random_bytes(20));
          $token->owner = $owner;
          $token->client = $client;
          $token->scopes = $scopes ?? [];
          $token->expiresAt = $ttl ? (new DateTime('@' . time(), new DateTimeZone('UTC')))->modify("+$ttl seconds") : null;
  
          return $token;
      }
code: protected static function createNew(
          int $ttl,
          TokenOwnerInterface $owner = null,
          Client $client = null,
          array $scopes = null
      ): self {
          if (is_array($scopes)) {
              $scopes = array_map(function ($scope) {
                  return (string) $scope;
              }, $scopes);
          }
  
          $token = new static();
  
          $token->token = bin2hex(random_bytes(20));
          $token->owner = $owner;
          $token->client = $client;
          $token->scopes = $scopes ?? [];
          $token->expiresAt = $ttl ? (new DateTime('@' . time(), new DateTimeZone('UTC')))->modify("+$ttl seconds") : null;
  
          return $token;
      }
code_tokens: protected static function createNew ( int $ ttl , TokenOwnerInterface $ owner = null , Client $ client = null , array $ scopes = null ) : self { if ( is_array ( $ scopes ) ) { $ scopes = array_map ( function ( $ scope ) { return ( string ) $ scope ; } , $ scopes ) ; } $ token = new static ( ) ; $ token -> token = bin2hex ( random_bytes ( 20 ) ) ; $ token -> owner = $ owner ; $ token -> client = $ client ; $ token -> scopes = $ scopes ?? [ ] ; $ token -> expiresAt = $ ttl ? ( new DateTime ( '@' . time ( ) , new DateTimeZone ( 'UTC' ) ) ) -> modify ( "+$ttl seconds" ) : null ; return $ token ; }
docstring: Create a new AbstractToken
  
  @param int                   $ttl
  @param TokenOwnerInterface   $owner
  @param Client                $client
  @param string[]|Scope[]|null $scopes
  @return AbstractToken
docstring_tokens: Create a new AbstractToken