Completed
Push — master ( a9877c...af7729 )
by
unknown
02:02 queued 11s
created
model/Concept.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
                 return $this->resource->label($fallback);
138 138
             }
139 139
             // We need to check all the labels in case one of them matches a subtag of the current language
140
-            foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
140
+            foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
141 141
                 // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
142
-                if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
142
+                if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
143 143
                     return EasyRdf\Literal::create($label, $fallback);
144 144
                 }
145 145
             }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function hasXlLabel($prop = 'prefLabel')
162 162
     {
163
-        if ($this->resource->hasProperty('skosxl:' . $prop)) {
163
+        if ($this->resource->hasProperty('skosxl:'.$prop)) {
164 164
             return true;
165 165
         }
166 166
         return false;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function getXlLabel()
170 170
     {
171 171
         $labels = $this->resource->allResources('skosxl:prefLabel');
172
-        foreach($labels as $labres) {
172
+        foreach ($labels as $labres) {
173 173
             $label = $labres->getLiteral('skosxl:literalForm');
174 174
             if ($label !== null && $label->getLang() == $this->clang) {
175 175
                 return new LabelSkosXL($this->model, $labres);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         // catch external subjects that have $res as object
277 277
         $extSubjects = $exGraph->resourcesMatching("schema:about", $res);
278 278
 
279
-        $propList =  array_unique(array_merge(
279
+        $propList = array_unique(array_merge(
280 280
             $this->DEFAULT_EXT_PROPERTIES,
281 281
             $this->getVocab()->getConfig()->getExtProperties(),
282 282
             $this->getVocab()->getConfig()->getPlugins()->getExtProperties()
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      * @param string[] $seen Processed resources so far
302 302
      * @param string[] $props (optional) limit to these property URIs
303 303
      */
304
-    private function addExternalTriplesToGraph($res, &$seen, $props=null)
304
+    private function addExternalTriplesToGraph($res, &$seen, $props = null)
305 305
     {
306 306
         if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
307 307
             return;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      */
332 332
     private function addPropertyValues($res, $prop, &$seen)
333 333
     {
334
-        $resList = $res->allResources('<' . $prop . '>');
334
+        $resList = $res->allResources('<'.$prop.'>');
335 335
 
336 336
         foreach ($resList as $res2) {
337 337
             if ($res2->isBNode()) {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             $this->addResourceReifications($res, $prop, $res2, $seen);
342 342
         }
343 343
 
344
-        $litList = $res->allLiterals('<' . $prop . '>');
344
+        $litList = $res->allLiterals('<'.$prop.'>');
345 345
 
346 346
         foreach ($litList as $lit) {
347 347
             $this->graph->addLiteral($res, $prop, $lit);
@@ -523,15 +523,15 @@  discard block
 block discarded – undo
523 523
                 // if not found in current vocabulary, look up in the default graph to be able
524 524
                 // to read an ontology loaded in a separate graph
525 525
                 // note that this imply that the property has an rdf:type declared for the query to work
526
-                if(!$is_well_known && !$proplabel) {
526
+                if (!$is_well_known && !$proplabel) {
527 527
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());
528 528
                     
529 529
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
530 530
 
531
-					if($envLangLabels) {
531
+					if ($envLangLabels) {
532 532
 						$proplabel = $envLangLabels[$this->getEnvLang()];
533 533
                     } else {
534
-						if($defaultPropLabel) {
534
+						if ($defaultPropLabel) {
535 535
 							$proplabel = $defaultPropLabel[''];
536 536
 						}
537 537
 					}
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
                 }
545 545
 
546 546
                 // also look up superprops in the default graph if not found in current vocabulary
547
-                if(!$is_well_known && (!$superprops || empty($superprops))) {
547
+                if (!$is_well_known && (!$superprops || empty($superprops))) {
548 548
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
549 549
                 }
550 550
 
551 551
                 // we're reading only one super property, even if there are multiple ones
552
-                $superprop = ($superprops)?$superprops[0]:null;
552
+                $superprop = ($superprops) ? $superprops[0] : null;
553 553
                 if ($superprop) {
554 554
                     $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
555 555
                 }
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
                 }
563 563
 
564 564
                 // searching for subproperties of literals too
565
-                if($superprops) {
565
+                if ($superprops) {
566 566
                     foreach ($superprops as $subi) {
567 567
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
568 568
                         $duplicates[$suburi] = $prop;
@@ -708,14 +708,14 @@  discard block
 block discarded – undo
708 708
 
709 709
             // making a human readable string from the timestamps
710 710
             if ($created != '') {
711
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short'));
711
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short'));
712 712
             }
713 713
 
714 714
             if ($modified != '') {
715 715
                 if ($created != '') {
716
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
716
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short'));
717 717
                 } else {
718
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
718
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short'));
719 719
                 }
720 720
 
721 721
             }
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
             trigger_error($e->getMessage(), E_USER_WARNING);
724 724
             $ret = '';
725 725
             if ($this->resource->get('dc:modified')) {
726
-                $modified = (string) $this->resource->get('dc:modified');
727
-                $ret = gettext('skosmos:modified') . ' ' . $modified;
726
+                $modified = (string)$this->resource->get('dc:modified');
727
+                $ret = gettext('skosmos:modified').' '.$modified;
728 728
             }
729 729
             if ($this->resource->get('dc:created')) {
730
-                $created .= (string) $this->resource->get('dc:created');
731
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created;
730
+                $created .= (string)$this->resource->get('dc:created');
731
+                $ret .= ' '.gettext('skosmos:created').' '.$created;
732 732
             }
733 733
         }
734 734
         return $ret;
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                     $groups[$collLabel] = array($group);
801 801
 
802 802
                     $res = $collection;
803
-                    while($super = $this->graph->resourcesMatching('skos:member', $res)) {
803
+                    while ($super = $this->graph->resourcesMatching('skos:member', $res)) {
804 804
                         foreach ($super as $res) {
805 805
                             $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang);
806 806
                             array_unshift($groups[$collLabel], $superprop);
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 
846 846
         foreach ($labels as $lit) {
847 847
             // filtering away subsets of the current language eg. en vs en-GB
848
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
848
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
849 849
                 $langCode = $lit->getLang() ? $lit->getLang() : '';
850 850
                 $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
851 851
             }
@@ -936,10 +936,10 @@  discard block
 block discarded – undo
936 936
             }
937 937
             else if ($context[$vocabPrefix] !== $vocabUriSpace) {
938 938
                 $i = 2;
939
-                while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
939
+                while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) {
940 940
                     $i += 1;
941 941
                 }
942
-                $context[$vocabPrefix . $i] = $vocabUriSpace;
942
+                $context[$vocabPrefix.$i] = $vocabUriSpace;
943 943
             }
944 944
         }
945 945
         $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
Please login to merge, or discard this patch.