| @@ -55,11 +55,11 @@ discard block | ||
| 55 | 55 | */ | 
| 56 | 56 | public function __construct($client_id, $client_secret, $curlbuilder = null) | 
| 57 | 57 |      { | 
| 58 | - if($curlbuilder == null) | |
| 58 | + if ($curlbuilder == null) | |
| 59 | 59 | $curlbuilder = new CurlBuilder(); | 
| 60 | 60 | |
| 61 | 61 | // Create new instance of Transport\Request | 
| 62 | - $this->request = new Request( $curlbuilder ); | |
| 62 | + $this->request = new Request($curlbuilder); | |
| 63 | 63 | |
| 64 | 64 | // Create and set new instance of the OAuth class | 
| 65 | 65 | $this->auth = new PinterestOAuth($client_id, $client_secret, $this->request); | 
| @@ -79,15 +79,15 @@ discard block | ||
| 79 | 79 | $class = "\\DirkGroenen\\Pinterest\\Endpoints\\" . ucfirst($endpoint); | 
| 80 | 80 | |
| 81 | 81 | // Check if an instance has already been initiated | 
| 82 | -        if(!isset($this->cachedEndpoints[$endpoint])){ | |
| 82 | +        if (!isset($this->cachedEndpoints[$endpoint])) { | |
| 83 | 83 | // Check endpoint existence | 
| 84 | - if(!class_exists($class)) | |
| 84 | + if (!class_exists($class)) | |
| 85 | 85 | throw new InvalidEndpointException; | 
| 86 | 86 | |
| 87 | 87 | // Create a reflection of the called class and initialize it | 
| 88 | 88 | // with a reference to the request class | 
| 89 | 89 | $ref = new \ReflectionClass($class); | 
| 90 | - $obj = $ref->newInstanceArgs([ $this->request, $this ]); | |
| 90 | + $obj = $ref->newInstanceArgs([$this->request, $this]); | |
| 91 | 91 | |
| 92 | 92 | $this->cachedEndpoints[$endpoint] = $obj; | 
| 93 | 93 | } | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | * @param string $client_id | 
| 56 | 56 | * @param string $client_secret | 
| 57 | 57 | */ | 
| 58 | - public function __construct( $client_id, $client_secret, $request ) | |
| 58 | + public function __construct($client_id, $client_secret, $request) | |
| 59 | 59 |      { | 
| 60 | 60 | $this->client_id = $client_id; | 
| 61 | 61 | $this->client_secret = $client_secret; | 
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | * @param string $redirect_uri | 
| 76 | 76 | * @return string | 
| 77 | 77 | */ | 
| 78 | -    public function getLoginUrl( $redirect_uri, $scopes = array("read_public"), $response_type = "code" ) | |
| 78 | +    public function getLoginUrl($redirect_uri, $scopes = array("read_public"), $response_type = "code") | |
| 79 | 79 |      { | 
| 80 | 80 | $queryparams = array( | 
| 81 | 81 | "response_type" => $response_type, | 
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 | ); | 
| 88 | 88 | |
| 89 | 89 | // Build url and return it | 
| 90 | - return sprintf( "%s?%s", self::AUTH_HOST, http_build_query($queryparams) ); | |
| 90 | +        return sprintf("%s?%s", self::AUTH_HOST, http_build_query($queryparams)); | |
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 | /** | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | */ | 
| 99 | 99 | private function generateState() | 
| 100 | 100 |      { | 
| 101 | - return substr( md5( rand() ), 0, 7 ); | |
| 101 | + return substr(md5(rand()), 0, 7); | |
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | 104 | /** | 
| @@ -128,7 +128,7 @@ discard block | ||
| 128 | 128 | * @param string $code | 
| 129 | 129 | * @return array | 
| 130 | 130 | */ | 
| 131 | - public function getOAuthToken( $code ) | |
| 131 | + public function getOAuthToken($code) | |
| 132 | 132 |      { | 
| 133 | 133 | // Build data array | 
| 134 | 134 | $data = array( | 
| @@ -151,7 +151,7 @@ discard block | ||
| 151 | 151 | * @param string $access_token | 
| 152 | 152 | * @return void | 
| 153 | 153 | */ | 
| 154 | - public function setOAuthToken( $access_token ) | |
| 154 | + public function setOAuthToken($access_token) | |
| 155 | 155 |      { | 
| 156 | 156 | $this->request->setAccessToken($access_token); | 
| 157 | 157 | } | 
| @@ -24,10 +24,10 @@ discard block | ||
| 24 | 24 | * @throws Exceptions/PinterestExceptions | 
| 25 | 25 | * @return Models\Board | 
| 26 | 26 | */ | 
| 27 | - public function get( $board_id, array $data = [] ) | |
| 27 | + public function get($board_id, array $data = []) | |
| 28 | 28 |      { | 
| 29 | -        $response = $this->request->get( sprintf("boards/%s", $board_id), $data ); | |
| 30 | - return new Board( $this->master, $response ); | |
| 29 | +        $response = $this->request->get(sprintf("boards/%s", $board_id), $data); | |
| 30 | + return new Board($this->master, $response); | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | /** | 
| @@ -38,10 +38,10 @@ discard block | ||
| 38 | 38 | * @throws Exceptions/PinterestExceptions | 
| 39 | 39 | * @return Models\Board | 
| 40 | 40 | */ | 
| 41 | - public function create( array $data ) | |
| 41 | + public function create(array $data) | |
| 42 | 42 |      { | 
| 43 | - $response = $this->request->post( "boards", $data ); | |
| 44 | - return new Board( $this->master, $response ); | |
| 43 | +        $response = $this->request->post("boards", $data); | |
| 44 | + return new Board($this->master, $response); | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 | /** | 
| @@ -52,9 +52,9 @@ discard block | ||
| 52 | 52 | * @throws Exceptions/PinterestExceptions | 
| 53 | 53 | * @return Models\Board | 
| 54 | 54 | */ | 
| 55 | - public function delete( $board_id ) | |
| 55 | + public function delete($board_id) | |
| 56 | 56 |      { | 
| 57 | -        $response = $this->request->delete( sprintf("boards/%s", $board_id) ); | |
| 57 | +        $response = $this->request->delete(sprintf("boards/%s", $board_id)); | |
| 58 | 58 | return true; | 
| 59 | 59 | } | 
| 60 | 60 | } | 
| 61 | 61 | \ No newline at end of file | 
| @@ -23,10 +23,10 @@ discard block | ||
| 23 | 23 | * @throws Exceptions/PinterestExceptions | 
| 24 | 24 | * @return Models\User | 
| 25 | 25 | */ | 
| 26 | - public function me( array $data = [] ) | |
| 26 | + public function me(array $data = []) | |
| 27 | 27 |      { | 
| 28 | -        $response = $this->request->get("me", $data ); | |
| 29 | - return new User( $this->master, $response ); | |
| 28 | +        $response = $this->request->get("me", $data); | |
| 29 | + return new User($this->master, $response); | |
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | 32 | /** | 
| @@ -38,10 +38,10 @@ discard block | ||
| 38 | 38 | * @throws Exceptions/PinterestExceptions | 
| 39 | 39 | * @return Models\User | 
| 40 | 40 | */ | 
| 41 | - public function find( $username, array $data = [] ) | |
| 41 | + public function find($username, array $data = []) | |
| 42 | 42 |      { | 
| 43 | -        $response = $this->request->get( sprintf("users/%s", $username), $data ); | |
| 44 | - return new User( $this->master, $response ); | |
| 43 | +        $response = $this->request->get(sprintf("users/%s", $username), $data); | |
| 44 | + return new User($this->master, $response); | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 | /** | 
| @@ -52,10 +52,10 @@ discard block | ||
| 52 | 52 | * @throws Exceptions/PinterestExceptions | 
| 53 | 53 | * @return Collection | 
| 54 | 54 | */ | 
| 55 | - public function getMePins( array $data = [] ) | |
| 55 | + public function getMePins(array $data = []) | |
| 56 | 56 |      { | 
| 57 | - $response = $this->request->get( "me/pins", $data ); | |
| 58 | - return new Collection( $this->master, $response, "Pin" ); | |
| 57 | +        $response = $this->request->get("me/pins", $data); | |
| 58 | + return new Collection($this->master, $response, "Pin"); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | /** | 
| @@ -66,11 +66,11 @@ discard block | ||
| 66 | 66 | * @throws Exceptions/PinterestExceptions | 
| 67 | 67 | * @return Collection | 
| 68 | 68 | */ | 
| 69 | - public function searchMePins( $query, array $data = [] ) | |
| 69 | + public function searchMePins($query, array $data = []) | |
| 70 | 70 |      { | 
| 71 | 71 | $data["query"] = $query; | 
| 72 | - $response = $this->request->get( "me/search/pins", $data ); | |
| 73 | - return new Collection( $this->master, $response, "Pin" ); | |
| 72 | +        $response = $this->request->get("me/search/pins", $data); | |
| 73 | + return new Collection($this->master, $response, "Pin"); | |
| 74 | 74 | } | 
| 75 | 75 | |
| 76 | 76 | /** | 
| @@ -81,12 +81,12 @@ discard block | ||
| 81 | 81 | * @throws Exceptions/PinterestExceptions | 
| 82 | 82 | * @return Collection | 
| 83 | 83 | */ | 
| 84 | - public function searchMeBoards( $query, array $data = [] ) | |
| 84 | + public function searchMeBoards($query, array $data = []) | |
| 85 | 85 |      { | 
| 86 | 86 | $data["query"] = $query; | 
| 87 | 87 | |
| 88 | - $response = $this->request->get( "me/search/boards", $data ); | |
| 89 | - return new Collection( $this->master, $response, "Board" ); | |
| 88 | +        $response = $this->request->get("me/search/boards", $data); | |
| 89 | + return new Collection($this->master, $response, "Board"); | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | /** | 
| @@ -97,10 +97,10 @@ discard block | ||
| 97 | 97 | * @throws Exceptions/PinterestExceptions | 
| 98 | 98 | * @return Collection | 
| 99 | 99 | */ | 
| 100 | - public function getMeBoards( array $data = [] ) | |
| 100 | + public function getMeBoards(array $data = []) | |
| 101 | 101 |      { | 
| 102 | - $response = $this->request->get( "me/boards", $data ); | |
| 103 | - return new Collection( $this->master, $response, "Board" ); | |
| 102 | +        $response = $this->request->get("me/boards", $data); | |
| 103 | + return new Collection($this->master, $response, "Board"); | |
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | 106 | /** | 
| @@ -111,10 +111,10 @@ discard block | ||
| 111 | 111 | * @throws Exceptions/PinterestExceptions | 
| 112 | 112 | * @return Collection | 
| 113 | 113 | */ | 
| 114 | - public function getMeLikes( array $data = [] ) | |
| 114 | + public function getMeLikes(array $data = []) | |
| 115 | 115 |      { | 
| 116 | - $response = $this->request->get( "me/likes", $data ); | |
| 117 | - return new Collection( $this->master, $response, "Pin" ); | |
| 116 | +        $response = $this->request->get("me/likes", $data); | |
| 117 | + return new Collection($this->master, $response, "Pin"); | |
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | 120 | /** | 
| @@ -127,8 +127,8 @@ discard block | ||
| 127 | 127 | */ | 
| 128 | 128 | public function getMeFollowers(array $data = []) | 
| 129 | 129 |      { | 
| 130 | - $response = $this->request->get( "me/followers", $data ); | |
| 131 | - return new Collection( $this->master, $response, "User" ); | |
| 130 | +        $response = $this->request->get("me/followers", $data); | |
| 131 | + return new Collection($this->master, $response, "User"); | |
| 132 | 132 | } | 
| 133 | 133 | |
| 134 | 134 | } | 
| @@ -24,10 +24,10 @@ discard block | ||
| 24 | 24 | * @throws Exceptions/PinterestExceptions | 
| 25 | 25 | * @return Collection | 
| 26 | 26 | */ | 
| 27 | - public function users( array $data = [] ) | |
| 27 | + public function users(array $data = []) | |
| 28 | 28 |      { | 
| 29 | - $response = $this->request->get( "me/following/users", $data ); | |
| 30 | - return new Collection( $this->master, $response, "User" ); | |
| 29 | +        $response = $this->request->get("me/following/users", $data); | |
| 30 | + return new Collection($this->master, $response, "User"); | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | /** | 
| @@ -38,10 +38,10 @@ discard block | ||
| 38 | 38 | * @throws Exceptions/PinterestExceptions | 
| 39 | 39 | * @return Collection | 
| 40 | 40 | */ | 
| 41 | - public function boards( array $data = [] ) | |
| 41 | + public function boards(array $data = []) | |
| 42 | 42 |      { | 
| 43 | - $response = $this->request->get( "me/following/boards", $data ); | |
| 44 | - return new Collection( $this->master, $response, "Board" ); | |
| 43 | +        $response = $this->request->get("me/following/boards", $data); | |
| 44 | + return new Collection($this->master, $response, "Board"); | |
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 | /** | 
| @@ -52,10 +52,10 @@ discard block | ||
| 52 | 52 | * @throws Exceptions/PinterestExceptions | 
| 53 | 53 | * @return Collection | 
| 54 | 54 | */ | 
| 55 | - public function interests( array $data = [] ) | |
| 55 | + public function interests(array $data = []) | |
| 56 | 56 |      { | 
| 57 | - $response = $this->request->get( "me/following/interests", $data ); | |
| 58 | - return new Collection( $this->master, $response, "Interest" ); | |
| 57 | +        $response = $this->request->get("me/following/interests", $data); | |
| 58 | + return new Collection($this->master, $response, "Interest"); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | /** | 
| @@ -66,11 +66,11 @@ discard block | ||
| 66 | 66 | * @throws Exceptions/PinterestExceptions | 
| 67 | 67 | * @return boolean | 
| 68 | 68 | */ | 
| 69 | - public function followUser( $user ) | |
| 69 | + public function followUser($user) | |
| 70 | 70 |      { | 
| 71 | - $user = $this->request->post( "me/following/users", array( | |
| 71 | +        $user = $this->request->post("me/following/users", array( | |
| 72 | 72 | "user" => $user | 
| 73 | - ) ); | |
| 73 | + )); | |
| 74 | 74 | return true; | 
| 75 | 75 | } | 
| 76 | 76 | |
| @@ -82,9 +82,9 @@ discard block | ||
| 82 | 82 | * @throws Exceptions/PinterestExceptions | 
| 83 | 83 | * @return boolean | 
| 84 | 84 | */ | 
| 85 | - public function unfollowUser( $user ) | |
| 85 | + public function unfollowUser($user) | |
| 86 | 86 |      { | 
| 87 | -        $user = $this->request->delete( sprintf("me/following/users/%s", $user) ); | |
| 87 | +        $user = $this->request->delete(sprintf("me/following/users/%s", $user)); | |
| 88 | 88 | return true; | 
| 89 | 89 | } | 
| 90 | 90 | |
| @@ -96,11 +96,11 @@ discard block | ||
| 96 | 96 | * @throws Exceptions/PinterestExceptions | 
| 97 | 97 | * @return boolean | 
| 98 | 98 | */ | 
| 99 | - public function followBoard( $board ) | |
| 99 | + public function followBoard($board) | |
| 100 | 100 |      { | 
| 101 | - $user = $this->request->post( "me/following/boards", array( | |
| 101 | +        $user = $this->request->post("me/following/boards", array( | |
| 102 | 102 | "board" => $board | 
| 103 | - ) ); | |
| 103 | + )); | |
| 104 | 104 | return true; | 
| 105 | 105 | } | 
| 106 | 106 | |
| @@ -112,9 +112,9 @@ discard block | ||
| 112 | 112 | * @throws Exceptions/PinterestExceptions | 
| 113 | 113 | * @return boolean | 
| 114 | 114 | */ | 
| 115 | - public function unfollowBoard( $board_id ) | |
| 115 | + public function unfollowBoard($board_id) | |
| 116 | 116 |      { | 
| 117 | -        $user = $this->request->delete( sprintf("me/following/boards/%s", $board_id) ); | |
| 117 | +        $user = $this->request->delete(sprintf("me/following/boards/%s", $board_id)); | |
| 118 | 118 | return true; | 
| 119 | 119 | } | 
| 120 | 120 | |
| @@ -126,11 +126,11 @@ discard block | ||
| 126 | 126 | * @throws Exceptions/PinterestExceptions | 
| 127 | 127 | * @return boolean | 
| 128 | 128 | */ | 
| 129 | - public function followInterest( $interest ) | |
| 129 | + public function followInterest($interest) | |
| 130 | 130 |      { | 
| 131 | - $user = $this->request->post( "me/following/interests", array( | |
| 131 | +        $user = $this->request->post("me/following/interests", array( | |
| 132 | 132 | "interest" => $interest | 
| 133 | - ) ); | |
| 133 | + )); | |
| 134 | 134 | return true; | 
| 135 | 135 | } | 
| 136 | 136 | |
| @@ -142,9 +142,9 @@ discard block | ||
| 142 | 142 | * @throws Exceptions/PinterestExceptions | 
| 143 | 143 | * @return boolean | 
| 144 | 144 | */ | 
| 145 | - public function unfollowInterest( $interest_id ) | |
| 145 | + public function unfollowInterest($interest_id) | |
| 146 | 146 |      { | 
| 147 | -        $user = $this->request->delete( sprintf("me/following/interests/%s", $interest_id) ); | |
| 147 | +        $user = $this->request->delete(sprintf("me/following/interests/%s", $interest_id)); | |
| 148 | 148 | return true; | 
| 149 | 149 | } | 
| 150 | 150 | } | 
| 151 | 151 | \ No newline at end of file | 
| @@ -37,7 +37,7 @@ | ||
| 37 | 37 | * @param Pinterest $master | 
| 38 | 38 | * @return void | 
| 39 | 39 | */ | 
| 40 | - public function __construct( Request $request, Pinterest $master ) | |
| 40 | + public function __construct(Request $request, Pinterest $master) | |
| 41 | 41 |      { | 
| 42 | 42 | $this->request = $request; | 
| 43 | 43 | $this->master = $master; | 
| @@ -24,10 +24,10 @@ discard block | ||
| 24 | 24 | * @throws Exceptions/PinterestExceptions | 
| 25 | 25 | * @return Models\Pin | 
| 26 | 26 | */ | 
| 27 | - public function get( $pin_id, array $data = [] ) | |
| 27 | + public function get($pin_id, array $data = []) | |
| 28 | 28 |      { | 
| 29 | -        $response = $this->request->get( sprintf("pins/%s", $pin_id), $data ); | |
| 30 | - return new Pin( $this->master, $response ); | |
| 29 | +        $response = $this->request->get(sprintf("pins/%s", $pin_id), $data); | |
| 30 | + return new Pin($this->master, $response); | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | /** | 
| @@ -39,10 +39,10 @@ discard block | ||
| 39 | 39 | * @throws Exceptions/PinterestExceptions | 
| 40 | 40 | * @return Models\Collection | 
| 41 | 41 | */ | 
| 42 | - public function fromBoard( $board_id, array $data = [] ) | |
| 42 | + public function fromBoard($board_id, array $data = []) | |
| 43 | 43 |      { | 
| 44 | -        $response = $this->request->get( sprintf("boards/%s/pins", $board_id), $data ); | |
| 45 | - return new Collection( $this->master, $response, "Pin" ); | |
| 44 | +        $response = $this->request->get(sprintf("boards/%s/pins", $board_id), $data); | |
| 45 | + return new Collection($this->master, $response, "Pin"); | |
| 46 | 46 | } | 
| 47 | 47 | |
| 48 | 48 | /** | 
| @@ -53,19 +53,19 @@ discard block | ||
| 53 | 53 | * @throws Exceptions/PinterestExceptions | 
| 54 | 54 | * @return Models\Pin | 
| 55 | 55 | */ | 
| 56 | - public function create( array $data ) | |
| 56 | + public function create(array $data) | |
| 57 | 57 |      { | 
| 58 | -        if( array_key_exists("image", $data) ){ | |
| 59 | -            if(class_exists("\CURLFile")){ | |
| 58 | +        if (array_key_exists("image", $data)) { | |
| 59 | +            if (class_exists("\CURLFile")) { | |
| 60 | 60 | $data["image"] = new \CURLFile($data['image']); | 
| 61 | 61 | } | 
| 62 | -            else{ | |
| 62 | +            else { | |
| 63 | 63 | $data["image"] = '@' . $data['image']; | 
| 64 | 64 | } | 
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | - $response = $this->request->post( "pins", $data ); | |
| 68 | - return new Pin( $this->master, $response ); | |
| 67 | +        $response = $this->request->post("pins", $data); | |
| 68 | + return new Pin($this->master, $response); | |
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | 71 | /** | 
| @@ -77,10 +77,10 @@ discard block | ||
| 77 | 77 | * @throws Exceptions/PinterestExceptions | 
| 78 | 78 | * @return Models\Pin | 
| 79 | 79 | */ | 
| 80 | - public function update( $pin_id, array $data ) | |
| 80 | + public function update($pin_id, array $data) | |
| 81 | 81 |      { | 
| 82 | -        $response = $this->request->update( sprintf("pins/%s", $pin_id), $data ); | |
| 83 | - return new Pin( $this->master, $response ); | |
| 82 | +        $response = $this->request->update(sprintf("pins/%s", $pin_id), $data); | |
| 83 | + return new Pin($this->master, $response); | |
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | 86 | /** | 
| @@ -91,9 +91,9 @@ discard block | ||
| 91 | 91 | * @throws Exceptions/PinterestExceptions | 
| 92 | 92 | * @return boolean | 
| 93 | 93 | */ | 
| 94 | - public function delete( $pin_id ) | |
| 94 | + public function delete($pin_id) | |
| 95 | 95 |      { | 
| 96 | -        $response = $this->request->delete( sprintf("pins/%s", $pin_id) ); | |
| 96 | +        $response = $this->request->delete(sprintf("pins/%s", $pin_id)); | |
| 97 | 97 | return true; | 
| 98 | 98 | } | 
| 99 | 99 | } | 
| 100 | 100 | \ No newline at end of file | 
| @@ -61,25 +61,25 @@ discard block | ||
| 61 | 61 | * @param string $model | 
| 62 | 62 | * @throws InvalidModelException | 
| 63 | 63 | */ | 
| 64 | -    public function __construct( Pinterest $master, $items, $model ){ | |
| 64 | +    public function __construct(Pinterest $master, $items, $model) { | |
| 65 | 65 | $this->master = $master; | 
| 66 | 66 | |
| 67 | 67 | // Create class path | 
| 68 | - $this->model = ucfirst( strtolower($model) ); | |
| 68 | + $this->model = ucfirst(strtolower($model)); | |
| 69 | 69 | |
| 70 | -        if(!class_exists("\\DirkGroenen\\Pinterest\\Models\\" . $this->model)) | |
| 70 | +        if (!class_exists("\\DirkGroenen\\Pinterest\\Models\\" . $this->model)) | |
| 71 | 71 | throw new InvalidModelException; | 
| 72 | 72 | |
| 73 | 73 | // Get items and response instance | 
| 74 | -        if( is_array($items) ){ | |
| 74 | +        if (is_array($items)) { | |
| 75 | 75 | $this->response = null; | 
| 76 | 76 | $this->items = $items; | 
| 77 | 77 | } | 
| 78 | -        else if( $items instanceof \DirkGroenen\Pinterest\Transport\Response ){ | |
| 78 | +        else if ($items instanceof \DirkGroenen\Pinterest\Transport\Response) { | |
| 79 | 79 | $this->response = $items; | 
| 80 | 80 | $this->items = $items->data; | 
| 81 | 81 | } | 
| 82 | -        else{ | |
| 82 | +        else { | |
| 83 | 83 |             throw new PinterestException("$items needs to be an instance of Transport\Response or an array."); | 
| 84 | 84 | } | 
| 85 | 85 | |
| @@ -87,10 +87,10 @@ discard block | ||
| 87 | 87 | $this->items = $this->buildCollectionModels($this->items); | 
| 88 | 88 | |
| 89 | 89 | // Add pagination object | 
| 90 | -        if( isset($this->response->page) && !empty($this->response->page['next']) ){ | |
| 90 | +        if (isset($this->response->page) && !empty($this->response->page['next'])) { | |
| 91 | 91 | $this->pagination = $this->response->page; | 
| 92 | 92 | } | 
| 93 | -        else{ | |
| 93 | +        else { | |
| 94 | 94 | $this->pagination = false; | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -117,9 +117,9 @@ discard block | ||
| 117 | 117 |      { | 
| 118 | 118 | $modelcollection = []; | 
| 119 | 119 | |
| 120 | -        foreach($items as $item){ | |
| 120 | +        foreach ($items as $item) { | |
| 121 | 121 |              $class = new \ReflectionClass("\\DirkGroenen\\Pinterest\\Models\\" . $this->model); | 
| 122 | - $modelcollection[] = $class->newInstanceArgs( [$this->master, $item] ); | |
| 122 | + $modelcollection[] = $class->newInstanceArgs([$this->master, $item]); | |
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | 125 | return $modelcollection; | 
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | */ | 
| 134 | 134 | public function hasNextPage() | 
| 135 | 135 |      { | 
| 136 | - return ($this->response != null && isset($this->response->page['next']) ); | |
| 136 | + return ($this->response != null && isset($this->response->page['next'])); | |
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | 139 | /** | 
| @@ -143,7 +143,7 @@ discard block | ||
| 143 | 143 | * @param int $index | 
| 144 | 144 | * @return Model | 
| 145 | 145 | */ | 
| 146 | - public function get( $index ) | |
| 146 | + public function get($index) | |
| 147 | 147 |      { | 
| 148 | 148 | return $this->items[$index]; | 
| 149 | 149 | } | 
| @@ -158,7 +158,7 @@ discard block | ||
| 158 | 158 |      { | 
| 159 | 159 | $items = []; | 
| 160 | 160 | |
| 161 | -        foreach($this->items as $item){ | |
| 161 | +        foreach ($this->items as $item) { | |
| 162 | 162 | $items[] = $item->toArray(); | 
| 163 | 163 | } | 
| 164 | 164 | |
| @@ -44,15 +44,15 @@ discard block | ||
| 44 | 44 | * @param array|Transport\Response $modeldata | 
| 45 | 45 | * @return void | 
| 46 | 46 | */ | 
| 47 | - public function __construct( Pinterest $master, $modeldata = null ) | |
| 47 | + public function __construct(Pinterest $master, $modeldata = null) | |
| 48 | 48 |      {    | 
| 49 | 49 | $this->master = $master; | 
| 50 | 50 | |
| 51 | 51 | // Fill the model | 
| 52 | -        if( is_array($modeldata) ){ | |
| 52 | +        if (is_array($modeldata)) { | |
| 53 | 53 | $this->fill($modeldata); | 
| 54 | 54 | } | 
| 55 | -        else if( $modeldata instanceof \DirkGroenen\Pinterest\Transport\Response ){ | |
| 55 | +        else if ($modeldata instanceof \DirkGroenen\Pinterest\Transport\Response) { | |
| 56 | 56 | $this->fill($modeldata->data); | 
| 57 | 57 | } | 
| 58 | 58 | } | 
| @@ -80,11 +80,11 @@ discard block | ||
| 80 | 80 | */ | 
| 81 | 81 | public function __set($key, $value) | 
| 82 | 82 |      { | 
| 83 | -        if($this->isFillable($key)){ | |
| 83 | +        if ($this->isFillable($key)) { | |
| 84 | 84 | $this->attributes[$key] = $value; | 
| 85 | 85 | } | 
| 86 | -        else{ | |
| 87 | -            throw new PinterestException( sprintf("%s is not a fillable attribute.", $key) ); | |
| 86 | +        else { | |
| 87 | +            throw new PinterestException(sprintf("%s is not a fillable attribute.", $key)); | |
| 88 | 88 | } | 
| 89 | 89 | } | 
| 90 | 90 | |
| @@ -108,8 +108,8 @@ discard block | ||
| 108 | 108 | */ | 
| 109 | 109 | private function fill(array $attributes) | 
| 110 | 110 |      { | 
| 111 | -        foreach($attributes as $key => $value){ | |
| 112 | -            if($this->isFillable($key)){ | |
| 111 | +        foreach ($attributes as $key => $value) { | |
| 112 | +            if ($this->isFillable($key)) { | |
| 113 | 113 | $this->attributes[$key] = $value; | 
| 114 | 114 | } | 
| 115 | 115 | } | 
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 |      { | 
| 138 | 138 | $array = array(); | 
| 139 | 139 | |
| 140 | -        foreach($this->fillable as $key){ | |
| 140 | +        foreach ($this->fillable as $key) { | |
| 141 | 141 |              $array[$key] = $this->{$key}; | 
| 142 | 142 | } | 
| 143 | 143 | |