seregazhuk\PinterestBot\Helpers\UrlBuilder::getFollowingUrlByType PHP Method

getFollowingUrlByType() public static method

public static getFollowingUrlByType ( string $type ) : string | null
$type string
return string | null
    public static function getFollowingUrlByType($type)
    {
        $urls = [self::FOLLOWING_INTERESTS => self::RESOURCE_FOLLOWING_INTERESTS, self::FOLLOWING_BOARDS => self::RESOURCE_FOLLOWING_BOARDS, self::FOLLOWING_PEOPLE => self::RESOURCE_USER_FOLLOWING];
        if (array_key_exists($type, $urls)) {
            return $urls[$type];
        }
        return null;
    }

Usage Example

Example #1
0
 /**
  * Get following info for pinner.
  *
  * @param string $username
  * @param string $type
  * @param int $limit
  * @return Iterator
  * @throws WrongFollowingType
  */
 public function following($username, $type = UrlBuilder::FOLLOWING_PEOPLE, $limit = Pagination::DEFAULT_LIMIT)
 {
     $followingUrl = UrlBuilder::getFollowingUrlByType($type);
     if (empty($followingUrl)) {
         throw new WrongFollowingType("No following results for {$type}");
     }
     return $this->paginate($username, $followingUrl, $limit);
 }