Completed
Push — master ( 157cf9...0e73b5 )
by Sam
03:38
created
src/Controllers/HomeController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		if ( ! $table_info ) {
16 16
 			$table_info = array();
17 17
 			foreach ( $db->get_tables() as $table ) {
18
-				$table_info[] = array(
18
+				$table_info[ ] = array(
19 19
 					'title' => $table->get_title(),
20 20
 					'count' => $table->count_records(),
21 21
 					'url' => $table->get_url(),
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		// Reports.
32 32
 		$reports_table = $db->get_table( \WordPress\Tabulate\DB\Reports::reports_table_name() );
33
-		$template->reports = ($reports_table) ? $reports_table->get_records( false ) : array();
33
+		$template->reports = ( $reports_table ) ? $reports_table->get_records( false ) : array();
34 34
 
35 35
 		return $template->render();
36 36
 	}
Please login to merge, or discard this patch.
src/Controllers/RecordController.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * Save a record.
80 80
 	 *
81 81
 	 * @param string[] $args The request arguments.
82
-	 * @return boolean
82
+	 * @return false|null
83 83
 	 */
84 84
 	public function save( $args ) {
85 85
 		$db = new \WordPress\Tabulate\DB\Database( $this->wpdb );
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * Delete (or ask for confirmation of deleting) a single record.
132 132
 	 *
133 133
 	 * @param string[] $args The request arguments.
134
-	 * @return type
134
+	 * @return null|string
135 135
 	 */
136 136
 	public function delete( $args ) {
137 137
 		$db = new \WordPress\Tabulate\DB\Database( $this->wpdb );
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	public function index( $args ) {
38 38
 		// Get database and table.
39 39
 		$db = new \WordPress\Tabulate\DB\Database( $this->wpdb );
40
-		$table = $db->get_table( $args['table'] );
40
+		$table = $db->get_table( $args[ 'table' ] );
41 41
 
42 42
 		// Give it all to the template.
43 43
 		$template = $this->get_template( $table );
44
-		if ( isset( $args['ident'] ) ) {
45
-			$template->record = $table->get_record( $args['ident'] );
44
+		if ( isset( $args[ 'ident' ] ) ) {
45
+			$template->record = $table->get_record( $args[ 'ident' ] );
46 46
 			// Check permission.
47 47
 			if ( ! Grants::current_user_can( Grants::UPDATE, $table->get_name() ) ) {
48 48
 				$template->add_notice( 'error', 'You do not have permission to update data in this table.' );
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 				$template->add_notice( 'error', 'You do not have permission to create records in this table.' );
56 56
 			}
57 57
 			// Add query-string values.
58
-			if ( isset( $args['defaults'] ) ) {
59
-				$template->record->set_multiple( $args['defaults'] );
58
+			if ( isset( $args[ 'defaults' ] ) ) {
59
+				$template->record->set_multiple( $args[ 'defaults' ] );
60 60
 			}
61 61
 		}
62 62
 		// Don't save to non-updatable views.
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		wp_enqueue_script( 'dashboard' );
69 69
 
70 70
 		// Return to URL.
71
-		if ( isset( $args['return_to'] ) ) {
72
-			$template->return_to = $args['return_to'];
71
+		if ( isset( $args[ 'return_to' ] ) ) {
72
+			$template->return_to = $args[ 'return_to' ];
73 73
 		}
74 74
 
75 75
 		return $template->render();
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function save( $args ) {
85 85
 		$db = new \WordPress\Tabulate\DB\Database( $this->wpdb );
86
-		$table = $db->get_table( $args['table'] );
86
+		$table = $db->get_table( $args[ 'table' ] );
87 87
 		if ( ! $table ) {
88 88
 			// It shouldn't be possible to get here via the UI, so no message.
89 89
 			return false;
90 90
 		}
91 91
 
92 92
 		// Guard against non-post requests. c.f. wp-comments-post.php.
93
-		if ( ! isset( $_SERVER['REQUEST_METHOD'] ) || 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
93
+		if ( ! isset( $_SERVER[ 'REQUEST_METHOD' ] ) || 'POST' !== $_SERVER[ 'REQUEST_METHOD' ] ) {
94 94
 			header( 'Allow: POST' );
95 95
 			header( 'HTTP/1.1 405 Method Not Allowed' );
96 96
 			header( 'Content-Type: text/plain' );
97 97
 			return false;
98 98
 		}
99 99
 
100
-		$record_ident = isset( $args['ident'] ) ? $args['ident'] : false;
100
+		$record_ident = isset( $args[ 'ident' ] ) ? $args[ 'ident' ] : false;
101 101
 		$this->verify_nonce( 'tabulate-record-' . $record_ident );
102 102
 		$template = $this->get_template( $table );
103 103
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$existing = $table->get_record( $pk );
108 108
 		if ( ! $record_ident && $existing ) {
109 109
 			$template->add_notice( 'updated', "The record identified by '$pk' already exists." );
110
-			$_REQUEST['return_to'] = $existing->get_url();
110
+			$_REQUEST[ 'return_to' ] = $existing->get_url();
111 111
 		} else {
112 112
 			// Otherwise, create a new one.
113 113
 			try {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			}
123 123
 		}
124 124
 		// Redirect back to the edit form.
125
-		$return_to = ( ! empty( $_REQUEST['return_to'] ) ) ? $_REQUEST['return_to'] : $template->record->get_url();
125
+		$return_to = ( ! empty( $_REQUEST[ 'return_to' ] ) ) ? $_REQUEST[ 'return_to' ] : $template->record->get_url();
126 126
 		wp_safe_redirect( $return_to );
127 127
 		exit;
128 128
 	}
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function delete( $args ) {
137 137
 		$db = new \WordPress\Tabulate\DB\Database( $this->wpdb );
138
-		$table = $db->get_table( $args['table'] );
139
-		$record_ident = isset( $args['ident'] ) ? $args['ident'] : false;
138
+		$table = $db->get_table( $args[ 'table' ] );
139
+		$record_ident = isset( $args[ 'ident' ] ) ? $args[ 'ident' ] : false;
140 140
 		if ( ! $record_ident ) {
141 141
 			wp_safe_redirect( $table->get_url() );
142 142
 			exit;
143 143
 		}
144 144
 
145 145
 		// Ask for confirmation.
146
-		if ( ! isset( $_POST['confirm_deletion'] ) ) {
146
+		if ( ! isset( $_POST[ 'confirm_deletion' ] ) ) {
147 147
 			$template = new \WordPress\Tabulate\Template( 'record/delete.html' );
148 148
 			$template->table = $table;
149 149
 			$template->record = $table->get_record( $record_ident );
Please login to merge, or discard this patch.
src/DB/Column.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	/**
118 118
 	 * Get the valid options for this column; only applies to ENUM and SET.
119 119
 	 *
120
-	 * @return array The available options.
120
+	 * @return string[] The available options.
121 121
 	 */
122 122
 	public function get_options() {
123 123
 		return $this->options;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	/**
271 271
 	 * Get the default value for this column.
272 272
 	 *
273
-	 * @return mixed
273
+	 * @return string|null
274 274
 	 */
275 275
 	public function get_default() {
276 276
 		if ( 'CURRENT_TIMESTAMP' === $this->default_value ) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -144,33 +144,33 @@  discard block
 block discarded – undo
144 144
 	protected function parse_info( $info ) {
145 145
 
146 146
 		// Name.
147
-		$this->name = $info['Field'];
147
+		$this->name = $info[ 'Field' ];
148 148
 
149 149
 		// Type.
150
-		$this->parse_type( $info['Type'] );
150
+		$this->parse_type( $info[ 'Type' ] );
151 151
 
152 152
 		// Default.
153
-		$this->default_value = $info['Default'];
153
+		$this->default_value = $info[ 'Default' ];
154 154
 
155 155
 		// Primary key.
156
-		if ( 'PRI' === strtoupper( $info['Key'] ) ) {
156
+		if ( 'PRI' === strtoupper( $info[ 'Key' ] ) ) {
157 157
 			$this->is_primary_key = true;
158
-			if ( 'auto_increment' === $info['Extra'] ) {
158
+			if ( 'auto_increment' === $info[ 'Extra' ] ) {
159 159
 				$this->is_auto_increment = true;
160 160
 			}
161 161
 		}
162 162
 
163 163
 		// Unique key.
164
-		$this->is_unique = ( 'UNI' === strtoupper( $info['Key'] ) );
164
+		$this->is_unique = ( 'UNI' === strtoupper( $info[ 'Key' ] ) );
165 165
 
166 166
 		// Comment.
167
-		$this->comment = $info['Comment'];
167
+		$this->comment = $info[ 'Comment' ];
168 168
 
169 169
 		// Collation.
170
-		$this->collation = $info['Collation'];
170
+		$this->collation = $info[ 'Collation' ];
171 171
 
172 172
 		// Is this column NULL?
173
-		$this->nullable = ( 'YES' === $info['Null'] );
173
+		$this->nullable = ( 'YES' === $info[ 'Null' ] );
174 174
 
175 175
 		// Is this a foreign key?
176 176
 		if ( in_array( $this->get_name(), $this->get_table()->get_foreign_key_names(), true ) ) {
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
 	public function get_xtype() {
303 303
 		$xtypes = self::get_xtypes();
304 304
 		if ( $this->is_foreign_key() ) {
305
-			return $xtypes['fk'];
305
+			return $xtypes[ 'fk' ];
306 306
 		}
307 307
 		if ( $this->is_boolean() ) {
308
-			return $xtypes['boolean'];
308
+			return $xtypes[ 'boolean' ];
309 309
 		}
310 310
 		// Otherwise fall back on the first xtype with a matching type.
311 311
 		foreach ( $xtypes as $xtype ) {
312
-			if ( strtoupper( $this->get_type() ) === $xtype['type'] ) {
312
+			if ( strtoupper( $this->get_type() ) === $xtype[ 'type' ] ) {
313 313
 				return $xtype;
314 314
 			}
315 315
 		}
@@ -506,22 +506,22 @@  discard block
 block discarded – undo
506 506
 		$this->scale = null;
507 507
 		$this->options = null;
508 508
 		if ( preg_match( $varchar_pattern, $type_string, $matches ) ) {
509
-			$this->type = $matches[1];
510
-			$this->size = (int) $matches[2];
509
+			$this->type = $matches[ 1 ];
510
+			$this->size = ( int ) $matches[ 2 ];
511 511
 		} elseif ( preg_match( $decimal_pattern, $type_string, $matches ) ) {
512 512
 			$this->type = 'decimal';
513
-			$this->precision = $matches[1];
514
-			$this->scale = $matches[2];
513
+			$this->precision = $matches[ 1 ];
514
+			$this->scale = $matches[ 2 ];
515 515
 		} elseif ( preg_match( $float_pattern, $type_string, $matches ) ) {
516 516
 			$this->type = 'float';
517
-			$this->precision = $matches[1];
518
-			$this->scale = $matches[2];
517
+			$this->precision = $matches[ 1 ];
518
+			$this->scale = $matches[ 2 ];
519 519
 		} elseif ( preg_match( $integer_pattern, $type_string, $matches ) ) {
520
-			$this->type = $matches[1];
521
-			$this->size = (int) $matches[2];
520
+			$this->type = $matches[ 1 ];
521
+			$this->size = ( int ) $matches[ 2 ];
522 522
 		} elseif ( preg_match( $enum_pattern, $type_string, $matches ) ) {
523
-			$this->type = $matches[1];
524
-			$values = explode( "','", $matches[2] );
523
+			$this->type = $matches[ 1 ];
524
+			$values = explode( "','", $matches[ 2 ] );
525 525
 			$this->options = array_combine( $values, $values );
526 526
 		}
527 527
 	}
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
 	 * @return string
533 533
 	 */
534 534
 	public function __toString() {
535
-		$pk = ($this->is_primary_key) ? ' PK' : '';
536
-		$auto = ($this->is_auto_increment) ? ' AI' : '';
535
+		$pk = ( $this->is_primary_key ) ? ' PK' : '';
536
+		$auto = ( $this->is_auto_increment ) ? ' AI' : '';
537 537
 		if ( $this->references ) {
538 538
 			$ref = ' References ' . $this->references . '.';
539 539
 		} else {
540 540
 			$ref = '';
541 541
 		}
542
-		$size = ($this->size > 0) ? "($this->size)" : '';
542
+		$size = ( $this->size > 0 ) ? "($this->size)" : '';
543 543
 		return $this->name . ' ' . strtoupper( $this->type ) . $size . $pk . $auto . $ref;
544 544
 	}
545 545
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	public function get_current_column_definition() {
552 552
 		return self::get_column_definition(
553 553
 			$this->get_name(),
554
-			$this->get_xtype()['name'],
554
+			$this->get_xtype()[ 'name' ],
555 555
 			$this->get_size(),
556 556
 			$this->nullable(),
557 557
 			$this->get_default(),
@@ -580,14 +580,14 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	public function alter( $new_name = null, $xtype_name = null, $size = null, $nullable = null, $default = null, $auto_increment = null, $unique = null, $comment = null, $target_table = null, $after = null ) {
582 582
 		// Any that have not been set explicitely should be unchanged.
583
-		$new_name = ! is_null( $new_name ) ? (string) $new_name : $this->get_name();
584
-		$xtype_name = ! is_null( $xtype_name ) ? (string) $xtype_name : $this->get_xtype()['name'];
583
+		$new_name = ! is_null( $new_name ) ? ( string ) $new_name : $this->get_name();
584
+		$xtype_name = ! is_null( $xtype_name ) ? ( string ) $xtype_name : $this->get_xtype()[ 'name' ];
585 585
 		$size = ! is_null( $size ) ? $size : $this->get_size();
586
-		$nullable = ! is_null( $nullable ) ? (boolean) $nullable : $this->nullable();
587
-		$default = ! is_null( $default ) ? (string) $default : $this->get_default();
588
-		$auto_increment = ! is_null( $auto_increment ) ? (boolean) $auto_increment : $this->is_auto_increment();
589
-		$unique = ! is_null( $unique ) ? (boolean) $unique : $this->is_unique();
590
-		$comment = ! is_null( $comment ) ? (string) $comment : $this->get_comment();
586
+		$nullable = ! is_null( $nullable ) ? ( boolean ) $nullable : $this->nullable();
587
+		$default = ! is_null( $default ) ? ( string ) $default : $this->get_default();
588
+		$auto_increment = ! is_null( $auto_increment ) ? ( boolean ) $auto_increment : $this->is_auto_increment();
589
+		$unique = ! is_null( $unique ) ? ( boolean ) $unique : $this->is_unique();
590
+		$comment = ! is_null( $comment ) ? ( string ) $comment : $this->get_comment();
591 591
 		$target_table = ! is_null( $target_table ) ? $target_table : $this->get_referenced_table();
592 592
 
593 593
 		// Check the current column definition.
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		if ( $this->is_unique() ) {
603 603
 			$sql = 'SHOW INDEXES FROM `' . $table->get_name() . '` WHERE Column_name LIKE "' . $this->get_name() . '"';
604 604
 			foreach ( $wpdb->get_results( $sql, ARRAY_A ) as $index ) {
605
-				$sql = "DROP INDEX `" . $index['Key_name'] . "` ON `" . $table->get_name() . "`";
605
+				$sql = "DROP INDEX `" . $index[ 'Key_name' ] . "` ON `" . $table->get_name() . "`";
606 606
 				$wpdb->query( $sql );
607 607
 			}
608 608
 		}
@@ -660,23 +660,23 @@  discard block
 block discarded – undo
660 660
 	public static function get_column_definition( $name, $xtype_name = null, $size = null, $nullable = true, $default = null, $auto_increment = null, $unique = null, $comment = null, $target_table = null, $after = null ) {
661 661
 		// Type.
662 662
 		$xtypes = self::get_xtypes();
663
-		$xtype = ( isset( $xtypes[ $xtype_name ] ) ) ? $xtypes[ $xtype_name ] : $xtypes['text_short'];
664
-		$type_str = $xtype['type'];
663
+		$xtype = ( isset( $xtypes[ $xtype_name ] ) ) ? $xtypes[ $xtype_name ] : $xtypes[ 'text_short' ];
664
+		$type_str = $xtype[ 'type' ];
665 665
 		// Size.
666 666
 		$size_str = '';
667
-		if ( $xtype['sizes'] > 0 ) {
668
-			$size_str = '(' . ( $size ? : 50 ) . ')';
667
+		if ( $xtype[ 'sizes' ] > 0 ) {
668
+			$size_str = '(' . ( $size ?: 50 ) . ')';
669 669
 		}
670 670
 		if ( 'boolean' === $xtype_name ) {
671 671
 			$size_str = '(1)';
672 672
 		}
673
-		$null_str = (true === $nullable) ? 'NULL' : 'NOT NULL';
673
+		$null_str = ( true === $nullable ) ? 'NULL' : 'NOT NULL';
674 674
 		$default_str = '';
675 675
 		if ( 'text_long' !== $xtype_name ) {
676 676
 			$default_str = ! empty( $default ) ? "DEFAULT '$default'" : ( $nullable ? 'DEFAULT NULL' : '' );
677 677
 		}
678 678
 		$auto_increment_str = '';
679
-		if ( $auto_increment && 'integer' === $xtype['name'] ) {
679
+		if ( $auto_increment && 'integer' === $xtype[ 'name' ] ) {
680 680
 			$auto_increment_str = 'AUTO_INCREMENT';
681 681
 		}
682 682
 		$unique_str = $unique ? 'UNIQUE' : '';
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				. ' (`' . $pk_col->get_name() . '`)';
698 698
 			$type_str = $pk_col->get_type();
699 699
 			$size_str = '(' . $pk_col->get_size() . ')';
700
-			$sign_str = ($pk_col->is_unsigned()) ? 'UNSIGNED' : '';
700
+			$sign_str = ( $pk_col->is_unsigned() ) ? 'UNSIGNED' : '';
701 701
 		}
702 702
 
703 703
 		// Put it all together.
Please login to merge, or discard this patch.
src/Controllers/ReportsController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 * View a report.
22 22
 	 *
23 23
 	 * @param string[] $args The request arguments.
24
-	 * @return type
24
+	 * @return null|string
25 25
 	 */
26 26
 	public function index( $args ) {
27 27
 		$db = new Database( $this->wpdb );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 */
26 26
 	public function index( $args ) {
27 27
 		$db = new Database( $this->wpdb );
28
-		$id = isset( $args['id'] ) ? $args['id'] : Reports::DEFAULT_REPORT_ID;
28
+		$id = isset( $args[ 'id' ] ) ? $args[ 'id' ] : Reports::DEFAULT_REPORT_ID;
29 29
 		$reports = new Reports( $db );
30 30
 		$template = $reports->get_template( $id );
31 31
 		$out = $template->render();
Please login to merge, or discard this patch.
src/Controllers/ApiController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$db = new Database( $this->wpdb );
48 48
 		$out = array();
49 49
 		foreach ( $db->get_tables( false ) as $table ) {
50
-			$out[] = array(
50
+			$out[ ] = array(
51 51
 				'value' => $table->get_name(),
52 52
 				'label' => $table->get_title(),
53 53
 			);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$out = array();
66 66
 		foreach ( $tables as $table ) {
67 67
 			if ( Grants::current_user_can( Grants::CREATE, $table->get_name() ) ) {
68
-				$out[] = $table->get_name();
68
+				$out[ ] = $table->get_name();
69 69
 			}
70 70
 		}
71 71
 		return $out;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return array
82 82
 	 */
83 83
 	public function foreign_key_values( \WP_REST_Request $request ) {
84
-		if ( ! isset( $this->get['term'] ) ) {
84
+		if ( ! isset( $this->get[ 'term' ] ) ) {
85 85
 			return array();
86 86
 		}
87 87
 		$db = new Database( $this->wpdb );
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 			return array();
91 91
 		}
92 92
 		// First get any exact matches.
93
-		$out = $this->foreign_key_values_build( $table, '=', $this->get['term'] );
93
+		$out = $this->foreign_key_values_build( $table, '=', $this->get[ 'term' ] );
94 94
 		// Then get any 'contains' matches.
95
-		$out += $this->foreign_key_values_build( $table, 'like', '%' . $this->get['term'] . '%' );
95
+		$out += $this->foreign_key_values_build( $table, 'like', '%' . $this->get[ 'term' ] . '%' );
96 96
 		return $out;
97 97
 	}
98 98
 
Please login to merge, or discard this patch.
src/Template.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public static function add_path( $new_path ) {
83 83
 		$path = realpath( $new_path );
84 84
 		if ( ! in_array( $path, self::$paths, true ) ) {
85
-			self::$paths[] = $path;
85
+			self::$paths[ ] = $path;
86 86
 		}
87 87
 	}
88 88
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		foreach ( self::$paths as $path ) {
106 106
 			$dir = $path . '/' . ltrim( $directory, '/' );
107 107
 			foreach ( preg_grep( '/^[^\.].*\.(twig|html)$/', scandir( $dir ) ) as $file ) {
108
-				$templates[] = $directory . '/' . $file;
108
+				$templates[ ] = $directory . '/' . $file;
109 109
 			}
110 110
 		}
111 111
 		return $templates;
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 	 * @param string $message The message to display.
151 151
 	 */
152 152
 	public function add_notice( $type, $message ) {
153
-		$this->data['notices'][] = array(
153
+		$this->data[ 'notices' ][ ] = array(
154 154
 			'type' => $type,
155 155
 			'message' => $message,
156 156
 		);
157
-		set_transient( $this->transient_notices, $this->data['notices'] );
157
+		set_transient( $this->transient_notices, $this->data[ 'notices' ] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			$twig->addFunction( $f, new \Twig_SimpleFunction( $f, $f ) );
183 183
 		}
184 184
 		// Handle wp_nonce_field() differently in order to default it to returning the string.
185
-		$wp_nonce_field = new \Twig_SimpleFunction( 'wp_nonce_field', function ( $action = -1, $name = "_wpnonce", $referer = true, $echo = false ) {
185
+		$wp_nonce_field = new \Twig_SimpleFunction( 'wp_nonce_field', function( $action = -1, $name = "_wpnonce", $referer = true, $echo = false ) {
186 186
 			return wp_nonce_field( $action, $name, $referer, $echo );
187 187
 		} );
188 188
 		$twig->addFunction( $wp_nonce_field );
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 	 * Get an item from this template's data.
136 136
 	 *
137 137
 	 * @param string $name The name of the template variable.
138
-	 * @return mixed
138
+	 * @return string
139 139
 	 */
140 140
 	public function __get( $name ) {
141 141
 		return $this->data[ $name ];
Please login to merge, or discard this patch.
src/DB/ChangeTracker.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,10 +163,10 @@
 block discarded – undo
163 163
 			);
164 164
 			// Daft workaround for https://core.trac.wordpress.org/ticket/15158 .
165 165
 			if ( ! is_null( $old_val ) ) {
166
-				$data['old_value'] = $old_val;
166
+				$data[ 'old_value' ] = $old_val;
167 167
 			}
168 168
 			if ( ! is_null( $new_val ) ) {
169
-				$data['new_value'] = $new_val;
169
+				$data[ 'new_value' ] = $new_val;
170 170
 			}
171 171
 			// Save the change record.
172 172
 			$this->wpdb->insert( $this->changes_name(), $data );
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param Table  $table The table into which the record is being saved.
118 118
 	 * @param string $pk_value The primary key of the record being saved. May be null.
119
-	 * @return boolean
119
+	 * @return false|null
120 120
 	 */
121 121
 	public function before_save( Table $table, $pk_value ) {
122 122
 		// Don't save changes to the changes tables.
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @param Table  $table The table the record is being saved in.
139 139
 	 * @param Record $new_record The record, after being saved.
140
-	 * @return boolean
140
+	 * @return false|null
141 141
 	 */
142 142
 	public function after_save( Table $table, Record $new_record ) {
143 143
 		// Don't save changes to the changes tables.
Please login to merge, or discard this patch.
src/DB/Record.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function __construct( $table, $data = array() ) {
43 43
 		$this->table = $table;
44
-		$this->data = (object) $data;
44
+		$this->data = ( object ) $data;
45 45
 	}
46 46
 
47 47
 	/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			$title_parts = array();
176 176
 			foreach ( $this->table->get_columns() as $col ) {
177 177
 				$col_name = $col->get_name() . self::FKTITLE;
178
-				$title_parts[] = $this->$col_name();
178
+				$title_parts[ ] = $this->$col_name();
179 179
 			}
180 180
 			return '[ ' . join( ' | ', $title_parts ) . ' ]';
181 181
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			'table' => $this->table->get_name(),
228 228
 		);
229 229
 		if ( $include_ident && false !== $this->get_primary_key() ) {
230
-			$params['ident'] = $this->get_primary_key();
230
+			$params[ 'ident' ] = $this->get_primary_key();
231 231
 		}
232 232
 		if ( is_array( $extra_params ) ) {
233 233
 			$params = array_merge( $params, $extra_params );
Please login to merge, or discard this patch.
src/Controllers/MapController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	protected function set_up( $args ) {
40 40
 		$db = new Database( $this->wpdb );
41
-		$this->table = $db->get_table( $args['table'] );
41
+		$this->table = $db->get_table( $args[ 'table' ] );
42 42
 
43 43
 		// Check that a point column exists.
44 44
 		$points = $this->table->get_columns( 'point' );
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$this->point_col_name = $point_col->get_name();
50 50
 
51 51
 		// Apply filters.
52
-		$filter_param = (isset( $args['filter'] )) ? $args['filter'] : array();
52
+		$filter_param = ( isset( $args[ 'filter' ] ) ) ? $args[ 'filter' ] : array();
53 53
 		$this->table->add_filters( $filter_param );
54 54
 		$this->table->add_filter( $this->point_col_name, 'not empty', '' );
55 55
 	}
Please login to merge, or discard this patch.