Completed
Push — master ( 2c2bba...8a235b )
by
unknown
06:46 queued 04:07
created
src/ConstraintParameterRenderer.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string HTML
64 64
 	 */
65
-	public function formatValue( $value ) {
66
-		if ( is_string( $value ) ) {
65
+	public function formatValue($value) {
66
+		if (is_string($value)) {
67 67
 			// Cases like 'Format' 'pattern' or 'minimum'/'maximum' values, which we have stored as
68 68
 			// strings
69
-			return htmlspecialchars( $value );
70
-		} elseif ( $value instanceof EntityId ) {
69
+			return htmlspecialchars($value);
70
+		} elseif ($value instanceof EntityId) {
71 71
 			// Cases like 'Conflicts with' 'property', to which we can link
72
-			return $this->formatEntityId( $value );
73
-		} elseif ( $value instanceof ItemIdSnakValue ) {
72
+			return $this->formatEntityId($value);
73
+		} elseif ($value instanceof ItemIdSnakValue) {
74 74
 			// Cases like EntityId but can also be somevalue or novalue
75
-			return $this->formatItemIdSnakValue( $value );
75
+			return $this->formatItemIdSnakValue($value);
76 76
 		} else {
77 77
 			// Cases where we format a DataValue
78
-			return $this->formatDataValue( $value );
78
+			return $this->formatDataValue($value);
79 79
 		}
80 80
 	}
81 81
 
@@ -86,23 +86,23 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return string HTML
88 88
 	 */
89
-	public function formatParameters( $parameters ) {
90
-		if ( $parameters === null || count( $parameters ) == 0 ) {
89
+	public function formatParameters($parameters) {
90
+		if ($parameters === null || count($parameters) == 0) {
91 91
 			return null;
92 92
 		}
93 93
 
94
-		$valueFormatter = function ( $value ) {
95
-			return $this->formatValue( $value );
94
+		$valueFormatter = function($value) {
95
+			return $this->formatValue($value);
96 96
 		};
97 97
 
98 98
 		$formattedParameters = [];
99
-		foreach ( $parameters as $parameterName => $parameterValue ) {
100
-			$formattedParameterValues = implode( ', ',
101
-				$this->limitArrayLength( array_map( $valueFormatter, $parameterValue ) ) );
102
-			$formattedParameters[] = sprintf( '%s: %s', $parameterName, $formattedParameterValues );
99
+		foreach ($parameters as $parameterName => $parameterValue) {
100
+			$formattedParameterValues = implode(', ',
101
+				$this->limitArrayLength(array_map($valueFormatter, $parameterValue)));
102
+			$formattedParameters[] = sprintf('%s: %s', $parameterName, $formattedParameterValues);
103 103
 		}
104 104
 
105
-		return implode( '; ', $formattedParameters );
105
+		return implode('; ', $formattedParameters);
106 106
 	}
107 107
 
108 108
 	/**
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return array
114 114
 	 */
115
-	private function limitArrayLength( array $array ) {
116
-		if ( count( $array ) > self::MAX_PARAMETER_ARRAY_LENGTH ) {
117
-			$array = array_slice( $array, 0, self::MAX_PARAMETER_ARRAY_LENGTH );
118
-			array_push( $array, '...' );
115
+	private function limitArrayLength(array $array) {
116
+		if (count($array) > self::MAX_PARAMETER_ARRAY_LENGTH) {
117
+			$array = array_slice($array, 0, self::MAX_PARAMETER_ARRAY_LENGTH);
118
+			array_push($array, '...');
119 119
 		}
120 120
 
121 121
 		return $array;
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 * @param DataValue $value
126 126
 	 * @return string HTML
127 127
 	 */
128
-	public function formatDataValue( DataValue $value ) {
129
-		return $this->dataValueFormatter->format( $value );
128
+	public function formatDataValue(DataValue $value) {
129
+		return $this->dataValueFormatter->format($value);
130 130
 	}
131 131
 
132 132
 	/**
133 133
 	 * @param EntityId $entityId
134 134
 	 * @return string HTML
135 135
 	 */
136
-	public function formatEntityId( EntityId $entityId ) {
137
-		return $this->entityIdLabelFormatter->formatEntityId( $entityId );
136
+	public function formatEntityId(EntityId $entityId) {
137
+		return $this->entityIdLabelFormatter->formatEntityId($entityId);
138 138
 	}
139 139
 
140 140
 	/**
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 	 * @param ItemIdSnakValue $value
144 144
 	 * @return string HTML
145 145
 	 */
146
-	public function formatItemIdSnakValue( ItemIdSnakValue $value ) {
147
-		switch ( true ) {
146
+	public function formatItemIdSnakValue(ItemIdSnakValue $value) {
147
+		switch (true) {
148 148
 			case $value->isValue():
149
-				return $this->formatEntityId( $value->getItemId() );
149
+				return $this->formatEntityId($value->getItemId());
150 150
 			case $value->isSomeValue():
151
-				return wfMessage( 'wikibase-snakview-snaktypeselector-somevalue' )->escaped();
151
+				return wfMessage('wikibase-snakview-snaktypeselector-somevalue')->escaped();
152 152
 			case $value->isNoValue():
153
-				return wfMessage( 'wikibase-snakview-snaktypeselector-novalue' )->escaped();
153
+				return wfMessage('wikibase-snakview-snaktypeselector-novalue')->escaped();
154 154
 		}
155 155
 	}
156 156
 
Please login to merge, or discard this patch.