@@ -6,37 +6,37 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Reference { |
| 8 | 8 | |
| 9 | - const STATED_IN = 'P248'; |
|
| 10 | - |
|
| 11 | - /** @var array */ |
|
| 12 | - protected $data; |
|
| 13 | - |
|
| 14 | - /** @var string */ |
|
| 15 | - protected $lang; |
|
| 16 | - |
|
| 17 | - /** @var CacheItemPoolInterface */ |
|
| 18 | - protected $cache; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * @param string[] $data The data. |
|
| 22 | - * @param string $lang ISO639 language code. |
|
| 23 | - * @param CacheItemPoolInterface $cache The cache. |
|
| 24 | - */ |
|
| 25 | - public function __construct( $data, $lang, $cache ) { |
|
| 26 | - $this->data = $data; |
|
| 27 | - $this->lang = $lang; |
|
| 28 | - $this->cache = $cache; |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @return Item|bool The item, or false if there isn't one. |
|
| 33 | - */ |
|
| 34 | - public function statedIn() { |
|
| 35 | - if ( !isset( $this->data['snaks'][self::STATED_IN] ) ) { |
|
| 36 | - return false; |
|
| 37 | - } |
|
| 38 | - foreach ( $this->data['snaks'][self::STATED_IN] as $snak ) { |
|
| 39 | - return Item::factory( $snak['datavalue']['value']['id'], $this->lang, $this->cache ); |
|
| 40 | - } |
|
| 41 | - } |
|
| 9 | + const STATED_IN = 'P248'; |
|
| 10 | + |
|
| 11 | + /** @var array */ |
|
| 12 | + protected $data; |
|
| 13 | + |
|
| 14 | + /** @var string */ |
|
| 15 | + protected $lang; |
|
| 16 | + |
|
| 17 | + /** @var CacheItemPoolInterface */ |
|
| 18 | + protected $cache; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @param string[] $data The data. |
|
| 22 | + * @param string $lang ISO639 language code. |
|
| 23 | + * @param CacheItemPoolInterface $cache The cache. |
|
| 24 | + */ |
|
| 25 | + public function __construct( $data, $lang, $cache ) { |
|
| 26 | + $this->data = $data; |
|
| 27 | + $this->lang = $lang; |
|
| 28 | + $this->cache = $cache; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @return Item|bool The item, or false if there isn't one. |
|
| 33 | + */ |
|
| 34 | + public function statedIn() { |
|
| 35 | + if ( !isset( $this->data['snaks'][self::STATED_IN] ) ) { |
|
| 36 | + return false; |
|
| 37 | + } |
|
| 38 | + foreach ( $this->data['snaks'][self::STATED_IN] as $snak ) { |
|
| 39 | + return Item::factory( $snak['datavalue']['value']['id'], $this->lang, $this->cache ); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @param string $lang ISO639 language code. |
| 23 | 23 | * @param CacheItemPoolInterface $cache The cache. |
| 24 | 24 | */ |
| 25 | - public function __construct( $data, $lang, $cache ) { |
|
| 25 | + public function __construct($data, $lang, $cache) { |
|
| 26 | 26 | $this->data = $data; |
| 27 | 27 | $this->lang = $lang; |
| 28 | 28 | $this->cache = $cache; |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * @return Item|bool The item, or false if there isn't one. |
| 33 | 33 | */ |
| 34 | 34 | public function statedIn() { |
| 35 | - if ( !isset( $this->data['snaks'][self::STATED_IN] ) ) { |
|
| 35 | + if (!isset($this->data['snaks'][self::STATED_IN])) { |
|
| 36 | 36 | return false; |
| 37 | 37 | } |
| 38 | - foreach ( $this->data['snaks'][self::STATED_IN] as $snak ) { |
|
| 39 | - return Item::factory( $snak['datavalue']['value']['id'], $this->lang, $this->cache ); |
|
| 38 | + foreach ($this->data['snaks'][self::STATED_IN] as $snak) { |
|
| 39 | + return Item::factory($snak['datavalue']['value']['id'], $this->lang, $this->cache); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |