Passed
Pull Request — master (#1198)
by
unknown
03:34
created
model/Concept.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
                 return $this->resource->label($fallback);
137 137
             }
138 138
             // We need to check all the labels in case one of them matches a subtag of the current language
139
-            foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
139
+            foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
140 140
                 // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
141
-                if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
141
+                if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
142 142
                     return EasyRdf\Literal::create($label, $fallback);
143 143
                 }
144 144
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     public function hasXlLabel($prop = 'prefLabel')
161 161
     {
162
-        if ($this->resource->hasProperty('skosxl:' . $prop)) {
162
+        if ($this->resource->hasProperty('skosxl:'.$prop)) {
163 163
             return true;
164 164
         }
165 165
         return false;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getXlLabel()
169 169
     {
170 170
         $labels = $this->resource->allResources('skosxl:prefLabel');
171
-        foreach($labels as $labres) {
171
+        foreach ($labels as $labres) {
172 172
             $label = $labres->getLiteral('skosxl:literalForm');
173 173
             if ($label !== null && $label->getLang() == $this->clang) {
174 174
                 return new LabelSkosXL($this->model, $labres);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         // catch external subjects that have $res as object
276 276
         $extSubjects = $exGraph->resourcesMatching("schema:about", $res);
277 277
 
278
-        $propList =  array_unique(array_merge(
278
+        $propList = array_unique(array_merge(
279 279
             $this->DEFAULT_EXT_PROPERTIES,
280 280
             $this->getVocab()->getConfig()->getExtProperties(),
281 281
             $this->getVocab()->getConfig()->getPlugins()->getExtProperties()
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      * @param string[] $seen Processed resources so far
301 301
      * @param string[] $props (optional) limit to these property URIs
302 302
      */
303
-    private function addExternalTriplesToGraph($res, &$seen, $props=null)
303
+    private function addExternalTriplesToGraph($res, &$seen, $props = null)
304 304
     {
305 305
         if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
306 306
             return;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      */
331 331
     private function addPropertyValues($res, $prop, &$seen)
332 332
     {
333
-        $resList = $res->allResources('<' . $prop . '>');
333
+        $resList = $res->allResources('<'.$prop.'>');
334 334
 
335 335
         foreach ($resList as $res2) {
336 336
             if ($res2->isBNode()) {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             $this->addResourceReifications($res, $prop, $res2, $seen);
341 341
         }
342 342
 
343
-        $litList = $res->allLiterals('<' . $prop . '>');
343
+        $litList = $res->allLiterals('<'.$prop.'>');
344 344
 
345 345
         foreach ($litList as $lit) {
346 346
             $this->graph->addLiteral($res, $prop, $lit);
@@ -528,15 +528,15 @@  discard block
 block discarded – undo
528 528
                 // if not found in current vocabulary, look up in the default graph to be able
529 529
                 // to read an ontology loaded in a separate graph
530 530
                 // note that this imply that the property has an rdf:type declared for the query to work
531
-                if(!$is_well_known && !$proplabel) {
531
+                if (!$is_well_known && !$proplabel) {
532 532
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());
533 533
                     
534 534
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
535 535
 
536
-					if($envLangLabels) {
536
+					if ($envLangLabels) {
537 537
 						$proplabel = $envLangLabels[$this->getEnvLang()];
538 538
                     } else {
539
-						if($defaultPropLabel) {
539
+						if ($defaultPropLabel) {
540 540
 							$proplabel = $defaultPropLabel[''];
541 541
 						}
542 542
 					}
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
                 }
550 550
 
551 551
                 // also look up superprops in the default graph if not found in current vocabulary
552
-                if(!$is_well_known && (!$superprops || empty($superprops))) {
552
+                if (!$is_well_known && (!$superprops || empty($superprops))) {
553 553
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
554 554
                 }
555 555
 
556 556
                 // we're reading only one super property, even if there are multiple ones
557
-                $superprop = ($superprops)?$superprops[0]:null;
557
+                $superprop = ($superprops) ? $superprops[0] : null;
558 558
                 if ($superprop) {
559 559
                     $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
560 560
                 }
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 }
568 568
 
569 569
                 // searching for subproperties of literals too
570
-                if($superprops) {
570
+                if ($superprops) {
571 571
                     foreach ($superprops as $subi) {
572 572
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
573 573
                         $duplicates[$suburi] = $prop;
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 
643 643
         $ret = $this->removeDuplicatePropertyValues($ret, $duplicates);
644 644
 
645
-        $ret = $this->vocab->getConfig()->getShowNotationAsProperty() !== null ? $this->removeNotationFromProperties($ret, $this->vocab->getConfig()->getShowNotationAsProperty()) : $ret ;
645
+        $ret = $this->vocab->getConfig()->getShowNotationAsProperty() !== null ? $this->removeNotationFromProperties($ret, $this->vocab->getConfig()->getShowNotationAsProperty()) : $ret;
646 646
 
647 647
         // sorting the properties to the order preferred in the Skosmos concept page.
648 648
         return $this->arbitrarySort($ret);
@@ -741,14 +741,14 @@  discard block
 block discarded – undo
741 741
 
742 742
             // making a human readable string from the timestamps
743 743
             if ($created != '') {
744
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang()));
744
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang()));
745 745
             }
746 746
 
747 747
             if ($modified != '') {
748 748
                 if ($created != '') {
749
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
749
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
750 750
                 } else {
751
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
751
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
752 752
                 }
753 753
 
754 754
             }
@@ -756,12 +756,12 @@  discard block
 block discarded – undo
756 756
             trigger_error($e->getMessage(), E_USER_WARNING);
757 757
             $ret = '';
758 758
             if ($this->resource->get('dc:modified')) {
759
-                $modified = (string) $this->resource->get('dc:modified');
760
-                $ret = gettext('skosmos:modified') . ' ' . $modified;
759
+                $modified = (string)$this->resource->get('dc:modified');
760
+                $ret = gettext('skosmos:modified').' '.$modified;
761 761
             }
762 762
             if ($this->resource->get('dc:created')) {
763
-                $created .= (string) $this->resource->get('dc:created');
764
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created;
763
+                $created .= (string)$this->resource->get('dc:created');
764
+                $ret .= ' '.gettext('skosmos:created').' '.$created;
765 765
             }
766 766
         }
767 767
         return $ret;
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                     $groups[$collLabel] = array($group);
834 834
 
835 835
                     $res = $collection;
836
-                    while($super = $this->graph->resourcesMatching('skos:member', $res)) {
836
+                    while ($super = $this->graph->resourcesMatching('skos:member', $res)) {
837 837
                         foreach ($super as $res) {
838 838
                             $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang);
839 839
                             array_unshift($groups[$collLabel], $superprop);
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 
879 879
         foreach ($labels as $lit) {
880 880
             // filtering away subsets of the current language eg. en vs en-GB
881
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
881
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
882 882
                 $langCode = $lit->getLang() ? $lit->getLang() : '';
883 883
                 $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
884 884
             }
@@ -970,10 +970,10 @@  discard block
 block discarded – undo
970 970
             }
971 971
             else if ($context[$vocabPrefix] !== $vocabUriSpace) {
972 972
                 $i = 2;
973
-                while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
973
+                while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) {
974 974
                     $i += 1;
975 975
                 }
976
-                $context[$vocabPrefix . $i] = $vocabUriSpace;
976
+                $context[$vocabPrefix.$i] = $vocabUriSpace;
977 977
             }
978 978
         }
979 979
         $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
Please login to merge, or discard this patch.