Passed
Push — master ( e27b5b...ca43c6 )
by Sam
02:55
created
examples/custom_entity_types.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,31 +13,31 @@  discard block
 block discarded – undo
13 13
  * @link https://www.wikidata.org/wiki/Wikidata:WikiProject_Railways
14 14
  */
15 15
 class RailwayStation extends \Samwilson\SimpleWikidata\Item {
16
-	// @codingStandardsIgnoreEnd
17
-	/**
18
-	 * Every subclass of Item should define its 'instance of' ID.
19
-	 */
20
-	const INSTANCE_OF = 'Q55488';
16
+    // @codingStandardsIgnoreEnd
17
+    /**
18
+     * Every subclass of Item should define its 'instance of' ID.
19
+     */
20
+    const INSTANCE_OF = 'Q55488';
21 21
 
22
-	/**
23
-	 * It can then contain any type-specific methods that are required.
24
-	 * @return RailwayStation[]
25
-	 */
26
-	public function hasAdjacentStations() {
27
-		return $this->getPropertyOfTypeItem( 'P197' );
28
-	}
22
+    /**
23
+     * It can then contain any type-specific methods that are required.
24
+     * @return RailwayStation[]
25
+     */
26
+    public function hasAdjacentStations() {
27
+        return $this->getPropertyOfTypeItem( 'P197' );
28
+    }
29 29
 
30
-	/**
31
-	 * Including queries.
32
-	 * @return RailwayStation[]
33
-	 */
34
-	public function isAdjacentTo() {
35
-		$sparql = "SELECT ?item WHERE { ?item wdt:P197 wd:" . $this->getId() . " }";
36
-		$query = new \Samwilson\SimpleWikidata\Query( $sparql, $this->lang, $this->cache );
37
-		// Each query result will also be a RailwayStation
38
-		// (if they're correctly recorded as such on Wikidata).
39
-		return $query->getItems();
40
-	}
30
+    /**
31
+     * Including queries.
32
+     * @return RailwayStation[]
33
+     */
34
+    public function isAdjacentTo() {
35
+        $sparql = "SELECT ?item WHERE { ?item wdt:P197 wd:" . $this->getId() . " }";
36
+        $query = new \Samwilson\SimpleWikidata\Query( $sparql, $this->lang, $this->cache );
37
+        // Each query result will also be a RailwayStation
38
+        // (if they're correctly recorded as such on Wikidata).
39
+        return $query->getItems();
40
+    }
41 41
 }
42 42
 
43 43
 // Then the class must register itself.
@@ -47,5 +47,5 @@  discard block
 block discarded – undo
47 47
 /** @var RailwayStation $eustonStation */
48 48
 $eustonStation = \Samwilson\SimpleWikidata\Item::factory( 'Q800751', 'en', $cache );
49 49
 echo $eustonStation->getLabel()
50
-	. " has " . count( $eustonStation->hasAdjacentStations() ) . " adjacent stations"
51
-	. " and is adjacent to " . count( $eustonStation->isAdjacentTo() ) . " stations.\n";
50
+    . " has " . count( $eustonStation->hasAdjacentStations() ) . " adjacent stations"
51
+    . " and is adjacent to " . count( $eustonStation->isAdjacentTo() ) . " stations.\n";
Please login to merge, or discard this patch.
examples/query.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
 $query = new \Samwilson\SimpleWikidata\Query( $sparql, 'en', $cache );
12 12
 $hills = $query->getItems();
13 13
 foreach ( $hills as $hill ) {
14
-	$heights = $hill->getPropertyOfTypeQuantity( 'P2044' );
15
-	if ( !$heights ) {
16
-		echo "No heights found for " . $hill->getLabel() . "\n";
17
-		continue;
18
-	}
19
-	$height = array_shift( $heights );
20
-	echo $hill->getLabel() . " is "
21
-		. $height['amount'] . " " . $height['unit']->getLabel() . " high.\n";
14
+    $heights = $hill->getPropertyOfTypeQuantity( 'P2044' );
15
+    if ( !$heights ) {
16
+        echo "No heights found for " . $hill->getLabel() . "\n";
17
+        continue;
18
+    }
19
+    $height = array_shift( $heights );
20
+    echo $hill->getLabel() . " is "
21
+        . $height['amount'] . " " . $height['unit']->getLabel() . " high.\n";
22 22
 }
Please login to merge, or discard this patch.
examples/search.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 $search = new \Samwilson\SimpleWikidata\Search( 'pride and prejudice', 'en', $cache );
10 10
 $items = $search->getItems( 3 );
11 11
 foreach ( $items as $item ) {
12
-	$instanceOf = $item->getPropertyOfTypeItem(
13
-		\Samwilson\SimpleWikidata\Item::PROP_INSTANCE_OF
14
-	);
15
-	$instanceOfLabel = isset( $instanceOf[0] ) ? $instanceOf[0]->getItem()->getLabel() : 'UNKNOWN';
16
-	echo $item->getLabel() . ' (' . $instanceOfLabel . ')' . "\n";
12
+    $instanceOf = $item->getPropertyOfTypeItem(
13
+        \Samwilson\SimpleWikidata\Item::PROP_INSTANCE_OF
14
+    );
15
+    $instanceOfLabel = isset( $instanceOf[0] ) ? $instanceOf[0]->getItem()->getLabel() : 'UNKNOWN';
16
+    echo $item->getLabel() . ' (' . $instanceOfLabel . ')' . "\n";
17 17
 }
Please login to merge, or discard this patch.
examples/humans.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 $datesOfBirth = $princeCharles->getDatesOfBirth();
18 18
 echo "  Date of birth: " . $datesOfBirth[0]->getDateTime()->format( 'j F, Y' ) . " ";
19 19
 foreach ( $datesOfBirth[0]->getReferences() as $ref ) {
20
-	if ( $ref->statedIn() ) {
21
-		echo "[$refNum]";
22
-		$references[$refNum] = $ref;
23
-	}
20
+    if ( $ref->statedIn() ) {
21
+        echo "[$refNum]";
22
+        $references[$refNum] = $ref;
23
+    }
24 24
 }
25 25
 echo "\n";
26 26
 
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 $fathers = $princeCharles->fathers();
29 29
 echo "  Father: " . $fathers[0]->getItem()->getLabel() . " ";
30 30
 foreach ( $fathers[0]->getReferences() as $ref ) {
31
-	if ( $ref->statedIn() ) {
32
-		echo "[$refNum]";
33
-		$references[$refNum] = $ref;
34
-	}
31
+    if ( $ref->statedIn() ) {
32
+        echo "[$refNum]";
33
+        $references[$refNum] = $ref;
34
+    }
35 35
 }
36 36
 echo "\n";
37 37
 
38 38
 foreach ( $references as $refNum => $ref ) {
39
-	echo "  [$refNum] - " . $ref->statedIn()->getLabel() . "\n";
39
+    echo "  [$refNum] - " . $ref->statedIn()->getLabel() . "\n";
40 40
 }
Please login to merge, or discard this patch.