PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Block Methods

  • exists() checks if the authenticating user is blocking a target user and can optionally return the blocked user's object if a block does exists.

    Example 886. Checking if block exists

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));

    // returns true or false
    $response $twitter->block->exists('blockeduser');

    // returns the blocked user's info if the user is blocked
    $response2 $twitter->block->exists('blockeduser'true);

    The favorites() method accepts a second optional parameter.

    • returnResult specifies whether or not return the user object instead of just TRUE or FALSE.

  • create() blocks the user specified in the id parameter as the authenticating user and destroys a friendship to the blocked user if one exists. Returns the blocked user in the requested format when successful.

    Example 887. Blocking a user

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->block->create('usertoblock);

  • destroy() un-blocks the user specified in the id parameter for the authenticating user. Returns the un-blocked user in the requested format when successful.

    Example 888. Removing a block

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));
    $response   $twitter->block->destroy('blockeduser');

  • blocking() returns an array of user objects that the authenticating user is blocking.

    Example 889. Who are you blocking

    <?php
    $twitter 
    = new Zend_Service_Twitter(array(
        
    'username' => 'johndoe',
        
    'accessToken' => $token
    ));

    // return the full user list from the first page
    $response $twitter->block->blocking();

    // return an array of numeric user IDs from the second page
    $response2 $twitter->block->blocking(2true);

    The favorites() method accepts two optional parameters.

    • page specifies which page ou want to return. A single page contains 20 IDs.

    • returnUserIds specifies whether to return an array of numeric user IDs the authenticating user is blocking instead of an array of user objects.

Zend Framework