@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | //call the API and decode the response |
| 30 | 30 | if($type=="user"){ |
| 31 | 31 | $url = "https://vimeo.com/api/v2/".$value."/videos.json"; |
| 32 | - } |
|
| 33 | - else{ |
|
| 32 | + } else{ |
|
| 34 | 33 | $url = "https://vimeo.com/api/v2/".$type."/".$value."/videos.json"; |
| 35 | 34 | } |
| 36 | 35 | |
@@ -47,7 +46,9 @@ discard block |
||
| 47 | 46 | */ |
| 48 | 47 | private function vimeo_output_array($videos,$count){ |
| 49 | 48 | foreach ($videos as $video) { |
| 50 | - if($count-- == 0) break; |
|
| 49 | + if($count-- == 0) { |
|
| 50 | + break; |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | $stream = array(); |
| 53 | 54 | |
@@ -258,7 +258,9 @@ |
||
| 258 | 258 | $encoded = $alphabet[$mod] . $encoded; |
| 259 | 259 | $num = intval($div); |
| 260 | 260 | } |
| 261 | - if ($num) $encoded = $alphabet[$num] . $encoded; |
|
| 261 | + if ($num) { |
|
| 262 | + $encoded = $alphabet[$num] . $encoded; |
|
| 263 | + } |
|
| 262 | 264 | return $encoded; |
| 263 | 265 | } |
| 264 | 266 | } |
@@ -40,14 +40,16 @@ discard block |
||
| 40 | 40 | $this->_retrieveOptions = array(); |
| 41 | 41 | if (is_array($id)) { |
| 42 | 42 | foreach ($id as $key => $value) { |
| 43 | - if ($key != 'id') |
|
| 44 | - $this->_retrieveOptions[$key] = $value; |
|
| 43 | + if ($key != 'id') { |
|
| 44 | + $this->_retrieveOptions[$key] = $value; |
|
| 45 | + } |
|
| 45 | 46 | } |
| 46 | 47 | $id = $id['id']; |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | - if ($id) |
|
| 50 | - $this->id = $id; |
|
| 50 | + if ($id) { |
|
| 51 | + $this->id = $id; |
|
| 52 | + } |
|
| 51 | 53 | } |
| 52 | 54 | |
| 53 | 55 | // Standard accessor magic methods |
@@ -67,8 +69,9 @@ discard block |
||
| 67 | 69 | // TODO: may want to clear from $_transientValues. (Won't be user-visible.) |
| 68 | 70 | $this->_values[$k] = $v; |
| 69 | 71 | } |
| 70 | - if (!self::$permanentAttributes->includes($k)) |
|
| 71 | - $this->_unsavedValues->add($k); |
|
| 72 | + if (!self::$permanentAttributes->includes($k)) { |
|
| 73 | + $this->_unsavedValues->add($k); |
|
| 74 | + } |
|
| 72 | 75 | } |
| 73 | 76 | public function __isset($k) |
| 74 | 77 | { |
@@ -156,25 +159,29 @@ discard block |
||
| 156 | 159 | // Wipe old state before setting new. This is useful for e.g. updating a |
| 157 | 160 | // customer, where there is no persistent card parameter. Mark those values |
| 158 | 161 | // which don't persist as transient |
| 159 | - if ($partial) |
|
| 160 | - $removed = new Util\Set(); |
|
| 161 | - else |
|
| 162 | - $removed = array_diff(array_keys($this->_values), array_keys(get_object_vars($values))); |
|
| 162 | + if ($partial) { |
|
| 163 | + $removed = new Util\Set(); |
|
| 164 | + } else { |
|
| 165 | + $removed = array_diff(array_keys($this->_values), array_keys(get_object_vars($values))); |
|
| 166 | + } |
|
| 163 | 167 | |
| 164 | 168 | foreach ($removed as $k) { |
| 165 | - if (self::$permanentAttributes->includes($k)) |
|
| 166 | - continue; |
|
| 169 | + if (self::$permanentAttributes->includes($k)) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 167 | 172 | unset($this->$k); |
| 168 | 173 | } |
| 169 | 174 | |
| 170 | 175 | foreach ($values as $k => $v) { |
| 171 | - if (self::$permanentAttributes->includes($k)) |
|
| 172 | - continue; |
|
| 176 | + if (self::$permanentAttributes->includes($k)) { |
|
| 177 | + continue; |
|
| 178 | + } |
|
| 173 | 179 | |
| 174 | - if (self::$nestedUpdatableAttributes->includes($k) && is_object($v)) |
|
| 175 | - $this->_values[$k] = AttachedObject::constructFrom($v, $opts); |
|
| 176 | - else |
|
| 177 | - $this->_values[$k] = Util\Util::convertToPingppObject($v, $opts); |
|
| 180 | + if (self::$nestedUpdatableAttributes->includes($k) && is_object($v)) { |
|
| 181 | + $this->_values[$k] = AttachedObject::constructFrom($v, $opts); |
|
| 182 | + } else { |
|
| 183 | + $this->_values[$k] = Util\Util::convertToPingppObject($v, $opts); |
|
| 184 | + } |
|
| 178 | 185 | |
| 179 | 186 | $this->_transientValues->discard($k); |
| 180 | 187 | $this->_unsavedValues->discard($k); |
@@ -231,10 +238,11 @@ discard block |
||
| 231 | 238 | |
| 232 | 239 | public function __toArray($recursive = false) |
| 233 | 240 | { |
| 234 | - if ($recursive) |
|
| 235 | - return Util\Util::convertPingppObjectToArray($this->_values); |
|
| 236 | - else |
|
| 237 | - return $this->_values; |
|
| 241 | + if ($recursive) { |
|
| 242 | + return Util\Util::convertPingppObjectToArray($this->_values); |
|
| 243 | + } else { |
|
| 244 | + return $this->_values; |
|
| 245 | + } |
|
| 238 | 246 | } |
| 239 | 247 | |
| 240 | 248 | public function __toStdObject() |
@@ -15,13 +15,15 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public static function isList($array) |
| 17 | 17 | { |
| 18 | - if (!is_array($array)) |
|
| 19 | - return false; |
|
| 18 | + if (!is_array($array)) { |
|
| 19 | + return false; |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | // TODO: generally incorrect, but it's correct given Pingpp's response |
| 22 | 23 | foreach (array_keys($array) as $k) { |
| 23 | - if (!is_numeric($k)) |
|
| 24 | - return false; |
|
| 24 | + if (!is_numeric($k)) { |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 25 | 27 | } |
| 26 | 28 | return true; |
| 27 | 29 | } |
@@ -101,8 +103,9 @@ discard block |
||
| 101 | 103 | ); |
| 102 | 104 | if (self::isList($resp)) { |
| 103 | 105 | $mapped = array(); |
| 104 | - foreach ($resp as $i) |
|
| 105 | - array_push($mapped, self::convertToPingppObject($i, $opts)); |
|
| 106 | + foreach ($resp as $i) { |
|
| 107 | + array_push($mapped, self::convertToPingppObject($i, $opts)); |
|
| 108 | + } |
|
| 106 | 109 | return $mapped; |
| 107 | 110 | } else if (is_object($resp)) { |
| 108 | 111 | if (isset($resp->object) |
@@ -30,8 +30,9 @@ |
||
| 30 | 30 | return 'false'; |
| 31 | 31 | } else if (is_array($d)) { |
| 32 | 32 | $res = array(); |
| 33 | - foreach ($d as $k => $v) |
|
| 34 | - $res[$k] = self::_encodeObjects($v, $is_post); |
|
| 33 | + foreach ($d as $k => $v) { |
|
| 34 | + $res[$k] = self::_encodeObjects($v, $is_post); |
|
| 35 | + } |
|
| 35 | 36 | return $res; |
| 36 | 37 | } else { |
| 37 | 38 | return Util\Util::utf8($d); |
@@ -2458,7 +2458,10 @@ |
||
| 2458 | 2458 | } |
| 2459 | 2459 | |
| 2460 | 2460 | protected function reduceRule409() { |
| 2461 | - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); |
|
| 2461 | + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) { |
|
| 2462 | + array_pop($this->semStack[$this->stackPos-(3-2)]); |
|
| 2463 | + } |
|
| 2464 | + ; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); |
|
| 2462 | 2465 | } |
| 2463 | 2466 | |
| 2464 | 2467 | protected function reduceRule410() { |
@@ -2878,7 +2878,10 @@ |
||
| 2878 | 2878 | } |
| 2879 | 2879 | |
| 2880 | 2880 | protected function reduceRule474() { |
| 2881 | - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, false); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); |
|
| 2881 | + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, false); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) { |
|
| 2882 | + array_pop($this->semStack[$this->stackPos-(3-2)]); |
|
| 2883 | + } |
|
| 2884 | + ; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); |
|
| 2882 | 2885 | } |
| 2883 | 2886 | |
| 2884 | 2887 | protected function reduceRule475() { |
@@ -100,9 +100,7 @@ |
||
| 100 | 100 | |
| 101 | 101 | try { |
| 102 | 102 | $this->comparator->assertEquals($expected, $actual); |
| 103 | - } |
|
| 104 | - |
|
| 105 | - catch (ComparisonFailure $exception) { |
|
| 103 | + } catch (ComparisonFailure $exception) { |
|
| 106 | 104 | } |
| 107 | 105 | |
| 108 | 106 | $this->assertNull($exception, 'Unexpected ComparisonFailure'); |
@@ -128,9 +128,7 @@ |
||
| 128 | 128 | |
| 129 | 129 | try { |
| 130 | 130 | $this->comparator->assertEquals($expected, $actual, $delta); |
| 131 | - } |
|
| 132 | - |
|
| 133 | - catch (ComparisonFailure $exception) { |
|
| 131 | + } catch (ComparisonFailure $exception) { |
|
| 134 | 132 | } |
| 135 | 133 | |
| 136 | 134 | $this->assertNull($exception, 'Unexpected ComparisonFailure'); |