Completed
Push — master ( 43d19f...7fdcb1 )
by Henri
03:15
created
model/Concept.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
         // 3. label in a subtag of the current language
123 123
         // We need to check all the labels in case one of them matches a subtag of the current language
124
-        foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
124
+        foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
125 125
             // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
126
-            if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) {
126
+            if ($label !== null && strpos($label->getLang(), $lang.'-') === 0) {
127 127
                 return EasyRdf\Literal::create($label, $lang);
128 128
             }
129 129
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         // 4. label in any language, including literal with empty language tag
132 132
         $label = $this->resource->label();
133 133
         if ($label !== null) {
134
-            return $label->getLang() ? $label->getValue() . " (" . $label->getLang() . ")" : $label->getValue();
134
+            return $label->getLang() ? $label->getValue()." (".$label->getLang().")" : $label->getValue();
135 135
         }
136 136
 
137 137
         // empty
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     public function hasXlLabel($prop = 'prefLabel')
142 142
     {
143
-        if ($this->resource->hasProperty('skosxl:' . $prop)) {
143
+        if ($this->resource->hasProperty('skosxl:'.$prop)) {
144 144
             return true;
145 145
         }
146 146
         return false;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public function getXlLabel()
150 150
     {
151 151
         $labels = $this->resource->allResources('skosxl:prefLabel');
152
-        foreach($labels as $labres) {
152
+        foreach ($labels as $labres) {
153 153
             $label = $labres->getLiteral('skosxl:literalForm');
154 154
             if ($label->getLang() == $this->clang) {
155 155
                 return new LabelSkosXL($this->model, $labres);
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
                 // if not found in current vocabulary, look up in the default graph to be able
361 361
                 // to read an ontology loaded in a separate graph
362 362
                 // note that this imply that the property has an rdf:type declared for the query to work
363
-                if(!$proplabel) {
363
+                if (!$proplabel) {
364 364
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());
365
-                    $proplabel = ($envLangLabels)?$envLangLabels[$this->getEnvLang()]:$this->model->getDefaultSparql()->queryLabel($longUri, '')[''];
365
+                    $proplabel = ($envLangLabels) ? $envLangLabels[$this->getEnvLang()] : $this->model->getDefaultSparql()->queryLabel($longUri, '')[''];
366 366
                 }                
367 367
                 
368 368
                 // look for superproperties in the current graph
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
                 }
373 373
                 
374 374
                 // also look up superprops in the default graph if not found in current vocabulary
375
-                if(!$superprops || empty($superprops)) {
375
+                if (!$superprops || empty($superprops)) {
376 376
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
377 377
                 }
378 378
                 
379 379
                 // we're reading only one super property, even if there are multiple ones
380
-                $superprop = ($superprops)?$superprops[0]:null;                
380
+                $superprop = ($superprops) ? $superprops[0] : null;                
381 381
                 if ($superprop) {
382 382
                     $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
383 383
                 }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                 }
390 390
 
391 391
                 // searching for subproperties of literals too
392
-                if($superprops) {
392
+                if ($superprops) {
393 393
                     foreach ($superprops as $subi) {
394 394
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
395 395
                         $duplicates[$suburi] = $prop;
@@ -509,14 +509,14 @@  discard block
 block discarded – undo
509 509
 
510 510
             // making a human readable string from the timestamps
511 511
             if ($created != '') {
512
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short'));
512
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short'));
513 513
             }
514 514
 
515 515
             if ($modified != '') {
516 516
                 if ($created != '') {
517
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
517
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short'));
518 518
                 } else {
519
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
519
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short'));
520 520
                 }
521 521
 
522 522
             }
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
             trigger_error($e->getMessage(), E_USER_WARNING);
525 525
             $ret = '';
526 526
             if ($this->resource->get('dc:modified')) {
527
-                $modified = (string) $this->resource->get('dc:modified');
528
-                $ret = gettext('skosmos:modified') . ' ' . $modified; 
527
+                $modified = (string)$this->resource->get('dc:modified');
528
+                $ret = gettext('skosmos:modified').' '.$modified; 
529 529
             }
530 530
             if ($this->resource->get('dc:created')) {
531
-                $created .= (string) $this->resource->get('dc:created');
532
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; 
531
+                $created .= (string)$this->resource->get('dc:created');
532
+                $ret .= ' '.gettext('skosmos:created').' '.$created; 
533 533
             }
534 534
         }
535 535
         return $ret;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
         $ret = array();
640 640
         foreach ($labels as $lit) {
641 641
             // filtering away subsets of the current language eg. en vs en-GB
642
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
642
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
643 643
                 $prop = in_array($lit, $prefLabels) ? 'skos:prefLabel' : 'skos:altLabel';
644 644
                 $ret[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
645 645
             }
Please login to merge, or discard this patch.