@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * @param int|string $poi_id POI ID. |
| 62 | 62 | * @param string $signature Signature. |
| 63 | 63 | */ |
| 64 | - public function __construct( $authentication, $expiry, $event_name, $poi_id, $signature ) { |
|
| 65 | - parent::__construct( $signature ); |
|
| 64 | + public function __construct($authentication, $expiry, $event_name, $poi_id, $signature) { |
|
| 65 | + parent::__construct($signature); |
|
| 66 | 66 | |
| 67 | 67 | $this->authentication = $authentication; |
| 68 | 68 | $this->expiry = $expiry; |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @return bool True if notice authentication token is epxired, false otherwise. |
| 95 | 95 | */ |
| 96 | 96 | public function is_expired() { |
| 97 | - $timestamp = strtotime( $this->get_expiry() ); |
|
| 97 | + $timestamp = strtotime($this->get_expiry()); |
|
| 98 | 98 | |
| 99 | - if ( false === $timestamp ) { |
|
| 99 | + if (false === $timestamp) { |
|
| 100 | 100 | return true; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -142,25 +142,25 @@ discard block |
||
| 142 | 142 | * @return Notification |
| 143 | 143 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
| 144 | 144 | */ |
| 145 | - public static function from_object( stdClass $object ) { |
|
| 146 | - if ( ! isset( $object->signature ) ) { |
|
| 147 | - throw new InvalidArgumentException( 'Object must contain `signature` property.' ); |
|
| 145 | + public static function from_object(stdClass $object) { |
|
| 146 | + if ( ! isset($object->signature)) { |
|
| 147 | + throw new InvalidArgumentException('Object must contain `signature` property.'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( ! isset( $object->authentication ) ) { |
|
| 151 | - throw new InvalidArgumentException( 'Object must contain `authentication` property.' ); |
|
| 150 | + if ( ! isset($object->authentication)) { |
|
| 151 | + throw new InvalidArgumentException('Object must contain `authentication` property.'); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if ( ! isset( $object->expiry ) ) { |
|
| 155 | - throw new InvalidArgumentException( 'Object must contain `expiry` property.' ); |
|
| 154 | + if ( ! isset($object->expiry)) { |
|
| 155 | + throw new InvalidArgumentException('Object must contain `expiry` property.'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if ( ! isset( $object->eventName ) ) { |
|
| 159 | - throw new InvalidArgumentException( 'Object must contain `eventName` property.' ); |
|
| 158 | + if ( ! isset($object->eventName)) { |
|
| 159 | + throw new InvalidArgumentException('Object must contain `eventName` property.'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( ! isset( $object->poiId ) ) { |
|
| 163 | - throw new InvalidArgumentException( 'Object must contain `poiId` property.' ); |
|
| 162 | + if ( ! isset($object->poiId)) { |
|
| 163 | + throw new InvalidArgumentException('Object must contain `poiId` property.'); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return new self( |
@@ -179,15 +179,15 @@ discard block |
||
| 179 | 179 | * @return Notification |
| 180 | 180 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
| 181 | 181 | */ |
| 182 | - public static function from_json( $json ) { |
|
| 183 | - $data = json_decode( $json ); |
|
| 182 | + public static function from_json($json) { |
|
| 183 | + $data = json_decode($json); |
|
| 184 | 184 | |
| 185 | 185 | $validator = new Validator(); |
| 186 | 186 | |
| 187 | - $validator->validate( $data, (object) array( |
|
| 188 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/notification.json' ), |
|
| 189 | - ), Constraint::CHECK_MODE_EXCEPTIONS ); |
|
| 187 | + $validator->validate($data, (object) array( |
|
| 188 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/notification.json'), |
|
| 189 | + ), Constraint::CHECK_MODE_EXCEPTIONS); |
|
| 190 | 190 | |
| 191 | - return self::from_object( $data ); |
|
| 191 | + return self::from_object($data); |
|
| 192 | 192 | } |
| 193 | 193 | } |