TijsVerkoyen\Twitter\Twitter::blocksCreate PHP Метод

blocksCreate() публичный Метод

Blocks the specified user from following the authenticating user. In addition the blocked user will not show in the authenticating users mentions or timeline (unless retweeted by another user). If a follow or friend relationship exists it is destroyed.
public blocksCreate ( string[optional] $userId = null, string[optional] $screenName = null, bool[optional] $includeEntities = null, bool[optional] $skipStatus = null ) : array
$userId string[optional]
$screenName string[optional]
$includeEntities bool[optional]
$skipStatus bool[optional]
Результат array
    public function blocksCreate($userId = null, $screenName = null, $includeEntities = null, $skipStatus = null)
    {
        // validate
        if ($userId == '' && $screenName == '') {
            throw new Exception('Specify an userId or a screenName.');
        }
        // build parameters
        if ($userId != null) {
            $parameters['user_id'] = (string) $userId;
        }
        if ($screenName != null) {
            $parameters['screen_name'] = (string) $screenName;
        }
        if ($includeEntities !== null) {
            $parameters['include_entities'] = $includeEntities ? 'true' : 'false';
        }
        if ($skipStatus !== null) {
            $parameters['skip_status'] = $skipStatus ? 'true' : 'false';
        }
        // make the call
        return $this->doCall('blocks/create.json', $parameters, true, 'POST');
    }

Usage Example

Пример #1
0
 /**
  * Tests Twitter->blocksCreate
  */
 public function testBlocksDestroy()
 {
     $response = $this->twitter->blocksCreate(null, 'netlash');
     $response = $this->twitter->blocksDestroy(null, 'netlash');
     $this->isUser($response);
 }
Twitter