@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | const FIELDS = [ |
| 19 | - 'mappings' => ['Set','Access'], |
|
| 19 | + 'mappings' => ['Set', 'Access'], |
|
| 20 | 20 | 'fromScheme' => 'ConceptScheme', |
| 21 | 21 | 'toScheme' => 'ConceptScheme', |
| 22 | 22 | 'extent' => 'string', |
| 23 | - 'license' => ['Set','Concept'], |
|
| 23 | + 'license' => ['Set', 'Concept'], |
|
| 24 | 24 | ]; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * Return a data structure to serialize this container as JSON. |
| 155 | 155 | */ |
| 156 | - public function jsonSerializeRoot($context=self::DEFAULT_CONTEXT) |
|
| 156 | + public function jsonSerializeRoot($context = self::DEFAULT_CONTEXT) |
|
| 157 | 157 | { |
| 158 | - $set = array_map(function ($m) { |
|
| 158 | + $set = array_map(function($m) { |
|
| 159 | 159 | return is_object($m) ? $m->jsonSerializeRoot(null) : $m; |
| 160 | 160 | }, $this->members); |
| 161 | 161 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * Return a data structure to serialize this container as JSON. |
| 30 | 30 | */ |
| 31 | - public function jsonSerializeRoot($context=self::DEFAULT_CONTEXT) |
|
| 31 | + public function jsonSerializeRoot($context = self::DEFAULT_CONTEXT) |
|
| 32 | 32 | { |
| 33 | 33 | $map = new \stdClass(); |
| 34 | 34 | foreach ($this->members as $lang => $list) { |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | 'example' => 'LanguageMapOfLists', |
| 22 | 22 | 'historyNote' => 'LanguageMapOfLists', |
| 23 | 23 | 'changeNote' => 'LanguageMapOfLists', |
| 24 | - 'subject' => ['Set','Concept'], |
|
| 25 | - 'subjectOf' => ['Set','Concept'], |
|
| 24 | + 'subject' => ['Set', 'Concept'], |
|
| 25 | + 'subjectOf' => ['Set', 'Concept'], |
|
| 26 | 26 | 'depiction' => ['Listing'], |
| 27 | 27 | 'startDate' => 'Date', |
| 28 | 28 | 'endDate' => 'Date', |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | class Registry extends Item |
| 13 | 13 | { |
| 14 | 14 | const FIELDS = [ |
| 15 | - 'concepts' => ['Set','Access'], |
|
| 16 | - 'schemes' => ['Set','Access'], |
|
| 17 | - 'types' => ['Set','Access'], |
|
| 18 | - 'mappings' => ['Set','Access'], |
|
| 19 | - 'registries' => ['Set','Access'], |
|
| 20 | - 'concordances' => ['Set','Access'], |
|
| 15 | + 'concepts' => ['Set', 'Access'], |
|
| 16 | + 'schemes' => ['Set', 'Access'], |
|
| 17 | + 'types' => ['Set', 'Access'], |
|
| 18 | + 'mappings' => ['Set', 'Access'], |
|
| 19 | + 'registries' => ['Set', 'Access'], |
|
| 20 | + 'concordances' => ['Set', 'Access'], |
|
| 21 | 21 | 'extent' => 'string', |
| 22 | 22 | 'languages' => ['Listing'], |
| 23 | - 'license' => ['Set','Concept'], |
|
| 23 | + 'license' => ['Set', 'Concept'], |
|
| 24 | 24 | ]; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | class Page extends PrettyJsonSerializable |
| 11 | 11 | { |
| 12 | - public $records; /**< array */ |
|
| 13 | - public $pageNum; /**< integer */ |
|
| 14 | - public $pageSize; /**< integer */ |
|
| 12 | + public $records; /**< array */ |
|
| 13 | + public $pageNum; /**< integer */ |
|
| 14 | + public $pageSize; /**< integer */ |
|
| 15 | 15 | public $totalCount; /**< integer */ |
| 16 | 16 | |
| 17 | - public function __construct($records=[], $pageSize=0, $pageNum=1, $totalCount=0) |
|
| 17 | + public function __construct($records = [], $pageSize = 0, $pageNum = 1, $totalCount = 0) |
|
| 18 | 18 | { |
| 19 | 19 | $this->records = $records; |
| 20 | 20 | $this->pageNum = $pageNum; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $count = count($records); |
| 24 | 24 | |
| 25 | - $totalCount = max($totalCount, ($pageNum-1)*$pageSize + $count); |
|
| 25 | + $totalCount = max($totalCount, ($pageNum - 1)*$pageSize + $count); |
|
| 26 | 26 | $this->totalCount = $totalCount; |
| 27 | 27 | |
| 28 | 28 | if ($pageSize == 0) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | public function nextPage() |
| 43 | 43 | { |
| 44 | 44 | if ($this->totalCount > $this->pageNum*$this->pageSize) { |
| 45 | - return $this->pageNum+1; |
|
| 45 | + return $this->pageNum + 1; |
|
| 46 | 46 | } else { |
| 47 | 47 | return 0; |
| 48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function lastPage() |
| 52 | 52 | { |
| 53 | - return (int)($this->totalCount / $this->pageSize); |
|
| 53 | + return (int)($this->totalCount/$this->pageSize); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - protected function setField(string $field, $value, bool $strict=true) |
|
| 40 | + protected function setField(string $field, $value, bool $strict = true) |
|
| 41 | 41 | { |
| 42 | 42 | if ($field == '@context') { |
| 43 | 43 | return; |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | } elseif (is_array($type)) { # Set or Listing |
| 59 | 59 | if ($type[0] == 'Set') { |
| 60 | 60 | if (is_array($value)) { |
| 61 | - $class = 'JSKOS\\'.$type[1]; |
|
| 61 | + $class = 'JSKOS\\' . $type[1]; |
|
| 62 | 62 | $value = new Set( |
| 63 | - array_map(function ($m) use ($class) { |
|
| 63 | + array_map(function($m) use ($class) { |
|
| 64 | 64 | if (is_null($m)) { |
| 65 | 65 | return null; |
| 66 | 66 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | }, $value) |
| 72 | 72 | ); |
| 73 | 73 | } elseif (!is_a($value, 'JSKOS\Set')) { |
| 74 | - $msg = get_called_class()."->$field must be a Set"; |
|
| 74 | + $msg = get_called_class() . "->$field must be a Set"; |
|
| 75 | 75 | throw new InvalidArgumentException($msg); |
| 76 | 76 | } else { |
| 77 | 77 | # TODO: check member types |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | if ($type == 'ConceptScheme') { |
| 96 | 96 | $value = new ConceptScheme($value); |
| 97 | 97 | } else { |
| 98 | - $msg = get_called_class()."->$field must match JSKOS\DataType::is$type"; |
|
| 98 | + $msg = get_called_class() . "->$field must match JSKOS\DataType::is$type"; |
|
| 99 | 99 | throw new InvalidArgumentException($msg); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | } else { |
| 122 | 122 | trigger_error( |
| 123 | - "Undefined property: ".get_called_class()."::$$field", |
|
| 123 | + "Undefined property: " . get_called_class() . "::$$field", |
|
| 124 | 124 | \E_USER_NOTICE |
| 125 | 125 | ); |
| 126 | 126 | return null; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @param Array|Object JSON data to copy |
| 139 | 139 | */ |
| 140 | - public function __construct($data=null, bool $strict=false) |
|
| 140 | + public function __construct($data = null, bool $strict = false) |
|
| 141 | 141 | { |
| 142 | 142 | if (is_array($data) or is_object($data)) { |
| 143 | 143 | foreach ($data as $key => $value) { |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * PHP library to process JSKOS data. |
| 4 | 4 | * |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param string $context |
| 36 | 36 | */ |
| 37 | - public function jsonSerializeRoot($context=self::DEFAULT_CONTEXT) |
|
| 37 | + public function jsonSerializeRoot($context = self::DEFAULT_CONTEXT) |
|
| 38 | 38 | { |
| 39 | - $json = [ ]; |
|
| 39 | + $json = []; |
|
| 40 | 40 | |
| 41 | 41 | foreach ($this as $key => $value) { |
| 42 | 42 | if (isset($value)) { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if ($context) { |
| 60 | 60 | $json['@context'] = $context; |
| 61 | - $types = defined(get_called_class().'::TYPES') ? static::TYPES : []; |
|
| 61 | + $types = defined(get_called_class() . '::TYPES') ? static::TYPES : []; |
|
| 62 | 62 | if (property_exists($this, 'type') and count($types)) { |
| 63 | 63 | if (isset($json['type'])) { |
| 64 | 64 | if (empty(array_intersect($json['type'], $types))) { |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace JSKOS; |
| 4 | 4 | |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | const FIELDS = [ |
| 19 | - 'narrower' => ['Set','Concept'], |
|
| 20 | - 'broader' => ['Set','Concept'], |
|
| 21 | - 'related' => ['Set','Concept'], |
|
| 22 | - 'previous' => ['Set','Concept'], |
|
| 23 | - 'next' => ['Set','Concept'], |
|
| 24 | - 'ancestors' => ['Set','Concept'], |
|
| 25 | - 'inScheme' => ['Set','ConceptScheme'], |
|
| 26 | - 'topConceptOf' => ['Set','ConceptScheme'], |
|
| 19 | + 'narrower' => ['Set', 'Concept'], |
|
| 20 | + 'broader' => ['Set', 'Concept'], |
|
| 21 | + 'related' => ['Set', 'Concept'], |
|
| 22 | + 'previous' => ['Set', 'Concept'], |
|
| 23 | + 'next' => ['Set', 'Concept'], |
|
| 24 | + 'ancestors' => ['Set', 'Concept'], |
|
| 25 | + 'inScheme' => ['Set', 'ConceptScheme'], |
|
| 26 | + 'topConceptOf' => ['Set', 'ConceptScheme'], |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | /** |