Fixed deprecations
This commit is contained in:
@@ -38,7 +38,7 @@ class NodeReader {
|
|||||||
* @param string|object $type The type to check for.
|
* @param string|object $type The type to check for.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasType(?Node $node = null, $type) {
|
public function hasType(?Node $node, $type) {
|
||||||
if (!isset($node))
|
if (!isset($node))
|
||||||
return false;
|
return false;
|
||||||
$type = $this->expand($type);
|
$type = $this->expand($type);
|
||||||
@@ -60,7 +60,7 @@ class NodeReader {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFirstValue(?Node $node = null, $property, $default = null) {
|
private function getFirstValue(?Node $node, $property, $default = null) {
|
||||||
if (!isset($node))
|
if (!isset($node))
|
||||||
return $default;
|
return $default;
|
||||||
$valueFromNode = $node->getProperty($this->expand($property));
|
$valueFromNode = $node->getProperty($this->expand($property));
|
||||||
@@ -82,7 +82,7 @@ class NodeReader {
|
|||||||
* @param $default The default that is returned if no value for the property exists on the node.
|
* @param $default The default that is returned if no value for the property exists on the node.
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getFirstValueString(?Node $node = null, $property, $default = null) {
|
public function getFirstValueString(?Node $node, $property, $default = null) {
|
||||||
$valueFromNode = $this->getFirstValue($node, $property, $default);
|
$valueFromNode = $this->getFirstValue($node, $property, $default);
|
||||||
if ($valueFromNode == $default)
|
if ($valueFromNode == $default)
|
||||||
return $default;
|
return $default;
|
||||||
@@ -103,7 +103,7 @@ class NodeReader {
|
|||||||
* @param $default The default that is returned if no value for the property exists on the node.
|
* @param $default The default that is returned if no value for the property exists on the node.
|
||||||
* @return bool|null
|
* @return bool|null
|
||||||
*/
|
*/
|
||||||
public function getFirstValueBool(?Node $node = null, $property, $default = null) {
|
public function getFirstValueBool(?Node $node, $property, $default = null) {
|
||||||
return (in_array(
|
return (in_array(
|
||||||
$this->getFirstValueString($node, $property, $default),
|
$this->getFirstValueString($node, $property, $default),
|
||||||
[ '1', 'true' ]
|
[ '1', 'true' ]
|
||||||
@@ -120,7 +120,7 @@ class NodeReader {
|
|||||||
* @param $default The default that is returned if no value for the property exists on the node.
|
* @param $default The default that is returned if no value for the property exists on the node.
|
||||||
* @return int|null
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
public function getFirstValueInt(?Node $node = null, $property, $default = null) {
|
public function getFirstValueInt(?Node $node, $property, $default = null) {
|
||||||
$value = $this->getFirstValueString($node, $property);
|
$value = $this->getFirstValueString($node, $property);
|
||||||
if (is_numeric($value))
|
if (is_numeric($value))
|
||||||
return (int)($value);
|
return (int)($value);
|
||||||
@@ -138,7 +138,7 @@ class NodeReader {
|
|||||||
* @param $default The default that is returned if no value for the property exists on the node.
|
* @param $default The default that is returned if no value for the property exists on the node.
|
||||||
* @return float|null
|
* @return float|null
|
||||||
*/
|
*/
|
||||||
public function getFirstValueFloat(?Node $node = null, $property, $default = null) {
|
public function getFirstValueFloat(?Node $node, $property, $default = null) {
|
||||||
$value = $this->getFirstValueString($node, $property);
|
$value = $this->getFirstValueString($node, $property);
|
||||||
if (is_numeric($value))
|
if (is_numeric($value))
|
||||||
return (float)($value);
|
return (float)($value);
|
||||||
@@ -156,7 +156,7 @@ class NodeReader {
|
|||||||
* @param $default The default that is returned if no value for the property exists on the node.
|
* @param $default The default that is returned if no value for the property exists on the node.
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getFirstValueIRI(?Node $node = null, $property, ?IRI $default = null) {
|
public function getFirstValueIRI(?Node $node, $property, ?IRI $default = null) {
|
||||||
$valueFromNode = $this->getFirstValue($node, $property, $default);
|
$valueFromNode = $this->getFirstValue($node, $property, $default);
|
||||||
if ($valueFromNode == $default)
|
if ($valueFromNode == $default)
|
||||||
return $default;
|
return $default;
|
||||||
@@ -177,7 +177,7 @@ class NodeReader {
|
|||||||
* @param $default The default that is returned if no value for the property exists on the node.
|
* @param $default The default that is returned if no value for the property exists on the node.
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getFirstValueNode(?Node $node = null, $property, ?Node $default = null) {
|
public function getFirstValueNode(?Node $node, $property, ?Node $default = null) {
|
||||||
$valueFromNode = $this->getFirstValue($node, $property, $default);
|
$valueFromNode = $this->getFirstValue($node, $property, $default);
|
||||||
if ($valueFromNode == $default)
|
if ($valueFromNode == $default)
|
||||||
return $default;
|
return $default;
|
||||||
@@ -196,7 +196,7 @@ class NodeReader {
|
|||||||
* @param string|object $value The expected value.
|
* @param string|object $value The expected value.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasPropertyValue(?Node $node = null, $property, $value) {
|
public function hasPropertyValue(?Node $node, $property, $value) {
|
||||||
if (!isset($node))
|
if (!isset($node))
|
||||||
return false;
|
return false;
|
||||||
$valuesFromNode = $node->getProperty($this->expand($property));
|
$valuesFromNode = $node->getProperty($this->expand($property));
|
||||||
@@ -225,14 +225,14 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasProperty(?Node $node = null, $property) {
|
public function hasProperty(?Node $node, $property) {
|
||||||
if (!isset($node))
|
if (!isset($node))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ($node->getProperty($this->expand($property)) != null);
|
return ($node->getProperty($this->expand($property)) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAllValues(?Node $node = null, $property) {
|
private function getAllValues(?Node $node, $property) {
|
||||||
if (!isset($node))
|
if (!isset($node))
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ class NodeReader {
|
|||||||
* Get the language-tagged-string for the property in the specified language.
|
* Get the language-tagged-string for the property in the specified language.
|
||||||
* If no value is found for the specified language, the default is returned.
|
* If no value is found for the specified language, the default is returned.
|
||||||
*/
|
*/
|
||||||
public function getLocalizedString(?Node $node = null, $property, $language, $default = null) {
|
public function getLocalizedString(?Node $node, $property, $language, $default = null) {
|
||||||
$values = $this->getAllValues($node, $property);
|
$values = $this->getAllValues($node, $property);
|
||||||
foreach ($values as $v) {
|
foreach ($values as $v) {
|
||||||
if (is_a($v, 'ML\JsonLD\LanguageTaggedString') && $v->getLanguage() == $language)
|
if (is_a($v, 'ML\JsonLD\LanguageTaggedString') && $v->getLanguage() == $language)
|
||||||
@@ -265,7 +265,7 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return array<string>
|
* @return array<string>
|
||||||
*/
|
*/
|
||||||
public function getAllValuesString(?Node $node = null, $property) {
|
public function getAllValuesString(?Node $node, $property) {
|
||||||
$allValues = $this->getAllValues($node, $property);
|
$allValues = $this->getAllValues($node, $property);
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($allValues as $a)
|
foreach ($allValues as $a)
|
||||||
@@ -284,7 +284,7 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return array<bool>
|
* @return array<bool>
|
||||||
*/
|
*/
|
||||||
public function getAllValuesBool(?Node $node = null, $property) {
|
public function getAllValuesBool(?Node $node, $property) {
|
||||||
$allValues = $this->getAllValuesString($node, $property);
|
$allValues = $this->getAllValuesString($node, $property);
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($allValues as $a)
|
foreach ($allValues as $a)
|
||||||
@@ -300,7 +300,7 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return array<bool>
|
* @return array<bool>
|
||||||
*/
|
*/
|
||||||
public function getAllValuesInt(?Node $node = null, $property) {
|
public function getAllValuesInt(?Node $node, $property) {
|
||||||
$allValues = $this->getAllValuesString($node, $property);
|
$allValues = $this->getAllValuesString($node, $property);
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($allValues as $a)
|
foreach ($allValues as $a)
|
||||||
@@ -316,7 +316,7 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return array<bool>
|
* @return array<bool>
|
||||||
*/
|
*/
|
||||||
public function getAllValuesFloat(?Node $node = null, $property) {
|
public function getAllValuesFloat(?Node $node, $property) {
|
||||||
$allValues = $this->getAllValuesString($node, $property);
|
$allValues = $this->getAllValuesString($node, $property);
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($allValues as $a)
|
foreach ($allValues as $a)
|
||||||
@@ -333,7 +333,7 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return array<IRI>
|
* @return array<IRI>
|
||||||
*/
|
*/
|
||||||
public function getAllValuesIRI(?Node $node = null, $property) {
|
public function getAllValuesIRI(?Node $node, $property) {
|
||||||
$allValues = $this->getAllValues($node, $property);
|
$allValues = $this->getAllValues($node, $property);
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($allValues as $a)
|
foreach ($allValues as $a)
|
||||||
@@ -351,7 +351,7 @@ class NodeReader {
|
|||||||
* @param string|object $property The property to read.
|
* @param string|object $property The property to read.
|
||||||
* @return array<Node>
|
* @return array<Node>
|
||||||
*/
|
*/
|
||||||
public function getAllValuesNode(?Node $node = null, $property) {
|
public function getAllValuesNode(?Node $node, $property) {
|
||||||
$allValues = $this->getAllValues($node, $property);
|
$allValues = $this->getAllValues($node, $property);
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($allValues as $a)
|
foreach ($allValues as $a)
|
||||||
|
|||||||
Reference in New Issue
Block a user