@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | class StringOrURI extends JsonValue { |
| 27 | 27 | |
| 28 | - public function getString(){ |
|
| 28 | + public function getString() { |
|
| 29 | 29 | return (string)$this->value; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | * @throws \RuntimeException |
| 34 | 34 | * @return string |
| 35 | 35 | */ |
| 36 | - public function getUri(){ |
|
| 36 | + public function getUri() { |
|
| 37 | 37 | |
| 38 | - if($this->isString()) |
|
| 38 | + if ($this->isString()) |
|
| 39 | 39 | throw new \RuntimeException('current value is not an uri!'); |
| 40 | - if(filter_var($this->value, FILTER_VALIDATE_URL) === false) |
|
| 40 | + if (filter_var($this->value, FILTER_VALIDATE_URL) === false) |
|
| 41 | 41 | throw new \RuntimeException('current value is not an uri!'); |
| 42 | 42 | |
| 43 | 43 | return (string)$this->value; |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @return bool |
| 48 | 48 | */ |
| 49 | - public function isString(){ |
|
| 49 | + public function isString() { |
|
| 50 | 50 | return !$this->isUri(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @return bool |
| 55 | 55 | */ |
| 56 | - public function isUri(){ |
|
| 56 | + public function isUri() { |
|
| 57 | 57 | return filter_var($this->value, FILTER_VALIDATE_URL) !== false; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function getValue(){ |
|
| 63 | + public function getValue() { |
|
| 64 | 64 | return $this->isUri() ? $this->getUri() : $this->getString(); |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |