@@ -57,6 +57,9 @@ |
||
| 57 | 57 | return $this->getRelatedObjectArr('identifiers'); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param \DateTime $when |
|
| 62 | + */ |
|
| 60 | 63 | public function currentAt($when) |
| 61 | 64 | { |
| 62 | 65 | return ($when >= $this->startDate && $when <= $this->endDate); |
@@ -53,6 +53,9 @@ discard block |
||
| 53 | 53 | return $this->arrGet($this->data, $popoloArray, []); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | + /** |
|
| 57 | + * @param string $attr |
|
| 58 | + */ |
|
| 56 | 59 | protected function getDate($attr, $default = null) |
| 57 | 60 | { |
| 58 | 61 | $d = $this->arrGet($this->data, $attr); |
@@ -62,6 +65,11 @@ discard block |
||
| 62 | 65 | return $default; |
| 63 | 66 | } |
| 64 | 67 | |
| 68 | + /** |
|
| 69 | + * @param string $popoloArray |
|
| 70 | + * @param string $infoTypeKey |
|
| 71 | + * @param string $infoValueKey |
|
| 72 | + */ |
|
| 65 | 73 | private function getRelatedValues($popoloArray, $infoTypeKey, $infoType, $infoValueKey) |
| 66 | 74 | { |
| 67 | 75 | /* Get a value from one of the Popolo related objects |
@@ -106,6 +114,9 @@ discard block |
||
| 106 | 114 | return $this->getRelatedValues('identifiers', 'scheme', $scheme, 'identifier'); |
| 107 | 115 | } |
| 108 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $scheme |
|
| 119 | + */ |
|
| 109 | 120 | public function identifierValue($scheme) |
| 110 | 121 | { |
| 111 | 122 | $identifierValues = $this->identifierValues($scheme); |
@@ -117,6 +128,9 @@ discard block |
||
| 117 | 128 | return $this->getRelatedValues('links', 'note', $note, 'url'); |
| 118 | 129 | } |
| 119 | 130 | |
| 131 | + /** |
|
| 132 | + * @param string $note |
|
| 133 | + */ |
|
| 120 | 134 | public function linkValue($note) |
| 121 | 135 | { |
| 122 | 136 | $linkValues = $this->linkValues($note); |
@@ -128,6 +142,9 @@ discard block |
||
| 128 | 142 | return $this->getRelatedValues('contact_details', 'type', $contactType, 'value'); |
| 129 | 143 | } |
| 130 | 144 | |
| 145 | + /** |
|
| 146 | + * @param string $contactType |
|
| 147 | + */ |
|
| 131 | 148 | public function contactDetailValue($contactType) |
| 132 | 149 | { |
| 133 | 150 | $contactDetailValues = $this->contactDetailValues($contactType); |
@@ -142,6 +159,9 @@ discard block |
||
| 142 | 159 | throw new \BadMethodCallException; |
| 143 | 160 | } |
| 144 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $popoloArray |
|
| 164 | + */ |
|
| 145 | 165 | public function getRelatedObjectArr($popoloArray) |
| 146 | 166 | { |
| 147 | 167 | return $this->arrGet($this->data, $popoloArray, []); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $properties = array_merge($this->baseProperties, $this->properties); |
| 34 | 34 | if (in_array($prop, $properties)) { |
| 35 | - $getter = 'get' . ucfirst($prop); |
|
| 35 | + $getter = 'get'.ucfirst($prop); |
|
| 36 | 36 | return $this->$getter(); |
| 37 | 37 | } |
| 38 | 38 | trigger_error('Undefined property: '.__CLASS__.'::$'.$prop, E_USER_ERROR); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function __get($prop) |
| 30 | 30 | { |
| 31 | 31 | if (in_array($prop, $this->properties)) { |
| 32 | - $getter = 'get' . ucfirst($prop); |
|
| 32 | + $getter = 'get'.ucfirst($prop); |
|
| 33 | 33 | return $this->$getter(); |
| 34 | 34 | } |
| 35 | 35 | trigger_error('Undefined property: '.__CLASS__.'::$'.$prop, E_USER_ERROR); |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | $matches = $this->filter($filters); |
| 64 | 64 | $n = count($matches); |
| 65 | 65 | if ($n == 0) { |
| 66 | - $msg = "No " . $this->objectClass . " found matching " . json_encode($filters); |
|
| 66 | + $msg = "No ".$this->objectClass." found matching ".json_encode($filters); |
|
| 67 | 67 | throw new Exceptions\ObjectDoesNotExistException($msg); |
| 68 | 68 | } elseif ($n > 1) { |
| 69 | - $msg = "Multiple " . $this->objectClass . " objects ($n) found matching " . json_encode($filters); |
|
| 69 | + $msg = "Multiple ".$this->objectClass." objects ($n) found matching ".json_encode($filters); |
|
| 70 | 70 | throw new Exceptions\MultipleObjectsReturnedException($msg); |
| 71 | 71 | } |
| 72 | 72 | return $matches[0]; |
@@ -252,8 +252,8 @@ |
||
| 252 | 252 | return $this->name; |
| 253 | 253 | } |
| 254 | 254 | if (count($namesAtDate) > 1) { |
| 255 | - $msg = 'Multiple names for ' . (string) $this; |
|
| 256 | - $msg .= ' found at date ' . $particularDate->format('Y-m-d'); |
|
| 255 | + $msg = 'Multiple names for '.(string) $this; |
|
| 256 | + $msg .= ' found at date '.$particularDate->format('Y-m-d'); |
|
| 257 | 257 | throw new \Exception($msg); |
| 258 | 258 | } |
| 259 | 259 | return $namesAtDate[0]['name']; |
@@ -57,6 +57,9 @@ |
||
| 57 | 57 | return $this->getRelatedObjectArr('identifiers'); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param \DateTime $when |
|
| 62 | + */ |
|
| 60 | 63 | public function currentAt($when) |
| 61 | 64 | { |
| 62 | 65 | return ($when >= $this->startDate && $when <= $this->endDate); |