Completed
Pull Request — master (#3)
by James
03:03
created
src/Core/Application.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -13,146 +13,146 @@
 block discarded – undo
13 13
  * @package Intraxia\Jaxion
14 14
  */
15 15
 class Application extends Container implements ApplicationContract {
16
-	/**
17
-	 * Define plugin version on Application.
18
-	 */
19
-	const VERSION = '';
20
-
21
-	/**
22
-	 * Singleton instance of the Application object
23
-	 *
24
-	 * @var Application
25
-	 */
26
-	protected static $instance = null;
27
-
28
-	/**
29
-	 * Instantiates a new Application container.
30
-	 *
31
-	 * The Application constructor enforces the presence of of a single instance
32
-	 * of the Application. If an instance already exists, an Exception will be thrown.
33
-	 *
34
-	 * @param string $file
35
-	 * @param array  $providers
36
-	 *
37
-	 * @throws ApplicationAlreadyBootedException
38
-	 */
39
-	public function __construct( $file, array $providers = array() ) {
40
-		if ( null !== static::$instance ) {
41
-			throw new ApplicationAlreadyBootedException;
42
-		}
43
-
44
-		static::$instance = $this;
45
-
46
-		$this->register_constants( $file );
47
-		$this->register_core_services();
48
-		$this->load_i18n();
49
-
50
-		register_activation_hook( $file, array( $this, 'activate' ) );
51
-		register_deactivation_hook( $file, array( $this, 'deactivate' ) );
52
-
53
-		parent::__construct( $providers );
54
-	}
55
-
56
-	/**
57
-	 * {@inheritDoc}
58
-	 *
59
-	 * @throws UnexpectedValueException
60
-	 */
61
-	public function boot() {
62
-		$loader = $this->fetch( 'loader' );
63
-
64
-		if ( ! $loader instanceof LoaderContract ) {
65
-			throw new UnexpectedValueException;
66
-		}
67
-
68
-		foreach ( $this as $alias => $value ) {
69
-			if ( $value instanceof HasActions ) {
70
-				$loader->register_actions( $value );
71
-			}
72
-
73
-			if ( $value instanceof HasFilters ) {
74
-				$loader->register_filters( $value );
75
-			}
76
-
77
-			if ( $value instanceof HasShortcode ) {
78
-				$loader->register_shortcode( $value );
79
-			}
80
-		}
81
-
82
-		add_action( 'plugins_loaded', array( $loader, 'run' ) );
83
-	}
84
-
85
-	/**
86
-	 * {@inheritdoc}
87
-	 *
88
-	 * @codeCoverageIgnore
89
-	 */
90
-	public function activate() {
91
-		// no-op
92
-	}
93
-
94
-	/**
95
-	 * {@inheritdoc}
96
-	 *
97
-	 * @codeCoverageIgnore
98
-	 */
99
-	public function deactivate() {
100
-		// no-op
101
-	}
102
-
103
-	/**
104
-	 * {@inheritDoc}
105
-	 *
106
-	 * @return Application
107
-	 * @throws ApplicationNotBootedException
108
-	 */
109
-	public static function instance() {
110
-		if ( null === static::$instance ) {
111
-			throw new ApplicationNotBootedException;
112
-		}
113
-
114
-		return static::$instance;
115
-	}
116
-
117
-	/**
118
-	 * {@inheritDoc}
119
-	 */
120
-	public static function shutdown() {
121
-		if ( null !== static::$instance ) {
122
-			static::$instance = null;
123
-		}
124
-	}
125
-
126
-	/**
127
-	 * Sets the plugin's url, path, and basename.
128
-	 *
129
-	 * @param string $file
130
-	 */
131
-	private function register_constants( $file ) {
132
-		$this->share( 'url', plugin_dir_url( $file ) );
133
-		$this->share( 'path', plugin_dir_path( $file ) );
134
-		$this->share( 'basename', $basename = plugin_basename( $file ) );
135
-		$this->share( 'slug', dirname( $basename ) );
136
-		$this->share( 'version', static::VERSION );
137
-	}
138
-
139
-	/**
140
-	 * Registers the built-in services with the Application container.
141
-	 */
142
-	private function register_core_services() {
143
-		$this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) {
144
-			return new Loader( $app );
145
-		} );
146
-	}
147
-
148
-	/**
149
-	 * Load's the plugin's translation files.
150
-	 */
151
-	private function load_i18n() {
152
-		load_plugin_textdomain(
153
-			$this->fetch( 'basename' ),
154
-			false,
155
-			basename( $this->fetch( 'path' ) ) . '/languages/'
156
-		);
157
-	}
16
+    /**
17
+     * Define plugin version on Application.
18
+     */
19
+    const VERSION = '';
20
+
21
+    /**
22
+     * Singleton instance of the Application object
23
+     *
24
+     * @var Application
25
+     */
26
+    protected static $instance = null;
27
+
28
+    /**
29
+     * Instantiates a new Application container.
30
+     *
31
+     * The Application constructor enforces the presence of of a single instance
32
+     * of the Application. If an instance already exists, an Exception will be thrown.
33
+     *
34
+     * @param string $file
35
+     * @param array  $providers
36
+     *
37
+     * @throws ApplicationAlreadyBootedException
38
+     */
39
+    public function __construct( $file, array $providers = array() ) {
40
+        if ( null !== static::$instance ) {
41
+            throw new ApplicationAlreadyBootedException;
42
+        }
43
+
44
+        static::$instance = $this;
45
+
46
+        $this->register_constants( $file );
47
+        $this->register_core_services();
48
+        $this->load_i18n();
49
+
50
+        register_activation_hook( $file, array( $this, 'activate' ) );
51
+        register_deactivation_hook( $file, array( $this, 'deactivate' ) );
52
+
53
+        parent::__construct( $providers );
54
+    }
55
+
56
+    /**
57
+     * {@inheritDoc}
58
+     *
59
+     * @throws UnexpectedValueException
60
+     */
61
+    public function boot() {
62
+        $loader = $this->fetch( 'loader' );
63
+
64
+        if ( ! $loader instanceof LoaderContract ) {
65
+            throw new UnexpectedValueException;
66
+        }
67
+
68
+        foreach ( $this as $alias => $value ) {
69
+            if ( $value instanceof HasActions ) {
70
+                $loader->register_actions( $value );
71
+            }
72
+
73
+            if ( $value instanceof HasFilters ) {
74
+                $loader->register_filters( $value );
75
+            }
76
+
77
+            if ( $value instanceof HasShortcode ) {
78
+                $loader->register_shortcode( $value );
79
+            }
80
+        }
81
+
82
+        add_action( 'plugins_loaded', array( $loader, 'run' ) );
83
+    }
84
+
85
+    /**
86
+     * {@inheritdoc}
87
+     *
88
+     * @codeCoverageIgnore
89
+     */
90
+    public function activate() {
91
+        // no-op
92
+    }
93
+
94
+    /**
95
+     * {@inheritdoc}
96
+     *
97
+     * @codeCoverageIgnore
98
+     */
99
+    public function deactivate() {
100
+        // no-op
101
+    }
102
+
103
+    /**
104
+     * {@inheritDoc}
105
+     *
106
+     * @return Application
107
+     * @throws ApplicationNotBootedException
108
+     */
109
+    public static function instance() {
110
+        if ( null === static::$instance ) {
111
+            throw new ApplicationNotBootedException;
112
+        }
113
+
114
+        return static::$instance;
115
+    }
116
+
117
+    /**
118
+     * {@inheritDoc}
119
+     */
120
+    public static function shutdown() {
121
+        if ( null !== static::$instance ) {
122
+            static::$instance = null;
123
+        }
124
+    }
125
+
126
+    /**
127
+     * Sets the plugin's url, path, and basename.
128
+     *
129
+     * @param string $file
130
+     */
131
+    private function register_constants( $file ) {
132
+        $this->share( 'url', plugin_dir_url( $file ) );
133
+        $this->share( 'path', plugin_dir_path( $file ) );
134
+        $this->share( 'basename', $basename = plugin_basename( $file ) );
135
+        $this->share( 'slug', dirname( $basename ) );
136
+        $this->share( 'version', static::VERSION );
137
+    }
138
+
139
+    /**
140
+     * Registers the built-in services with the Application container.
141
+     */
142
+    private function register_core_services() {
143
+        $this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) {
144
+            return new Loader( $app );
145
+        } );
146
+    }
147
+
148
+    /**
149
+     * Load's the plugin's translation files.
150
+     */
151
+    private function load_i18n() {
152
+        load_plugin_textdomain(
153
+            $this->fetch( 'basename' ),
154
+            false,
155
+            basename( $this->fetch( 'path' ) ) . '/languages/'
156
+        );
157
+    }
158 158
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @throws ApplicationAlreadyBootedException
38 38
 	 */
39
-	public function __construct( $file, array $providers = array() ) {
40
-		if ( null !== static::$instance ) {
39
+	public function __construct($file, array $providers = array()) {
40
+		if (null !== static::$instance) {
41 41
 			throw new ApplicationAlreadyBootedException;
42 42
 		}
43 43
 
44 44
 		static::$instance = $this;
45 45
 
46
-		$this->register_constants( $file );
46
+		$this->register_constants($file);
47 47
 		$this->register_core_services();
48 48
 		$this->load_i18n();
49 49
 
50
-		register_activation_hook( $file, array( $this, 'activate' ) );
51
-		register_deactivation_hook( $file, array( $this, 'deactivate' ) );
50
+		register_activation_hook($file, array($this, 'activate'));
51
+		register_deactivation_hook($file, array($this, 'deactivate'));
52 52
 
53
-		parent::__construct( $providers );
53
+		parent::__construct($providers);
54 54
 	}
55 55
 
56 56
 	/**
@@ -59,27 +59,27 @@  discard block
 block discarded – undo
59 59
 	 * @throws UnexpectedValueException
60 60
 	 */
61 61
 	public function boot() {
62
-		$loader = $this->fetch( 'loader' );
62
+		$loader = $this->fetch('loader');
63 63
 
64
-		if ( ! $loader instanceof LoaderContract ) {
64
+		if (!$loader instanceof LoaderContract) {
65 65
 			throw new UnexpectedValueException;
66 66
 		}
67 67
 
68
-		foreach ( $this as $alias => $value ) {
69
-			if ( $value instanceof HasActions ) {
70
-				$loader->register_actions( $value );
68
+		foreach ($this as $alias => $value) {
69
+			if ($value instanceof HasActions) {
70
+				$loader->register_actions($value);
71 71
 			}
72 72
 
73
-			if ( $value instanceof HasFilters ) {
74
-				$loader->register_filters( $value );
73
+			if ($value instanceof HasFilters) {
74
+				$loader->register_filters($value);
75 75
 			}
76 76
 
77
-			if ( $value instanceof HasShortcode ) {
78
-				$loader->register_shortcode( $value );
77
+			if ($value instanceof HasShortcode) {
78
+				$loader->register_shortcode($value);
79 79
 			}
80 80
 		}
81 81
 
82
-		add_action( 'plugins_loaded', array( $loader, 'run' ) );
82
+		add_action('plugins_loaded', array($loader, 'run'));
83 83
 	}
84 84
 
85 85
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @throws ApplicationNotBootedException
108 108
 	 */
109 109
 	public static function instance() {
110
-		if ( null === static::$instance ) {
110
+		if (null === static::$instance) {
111 111
 			throw new ApplicationNotBootedException;
112 112
 		}
113 113
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * {@inheritDoc}
119 119
 	 */
120 120
 	public static function shutdown() {
121
-		if ( null !== static::$instance ) {
121
+		if (null !== static::$instance) {
122 122
 			static::$instance = null;
123 123
 		}
124 124
 	}
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @param string $file
130 130
 	 */
131
-	private function register_constants( $file ) {
132
-		$this->share( 'url', plugin_dir_url( $file ) );
133
-		$this->share( 'path', plugin_dir_path( $file ) );
134
-		$this->share( 'basename', $basename = plugin_basename( $file ) );
135
-		$this->share( 'slug', dirname( $basename ) );
136
-		$this->share( 'version', static::VERSION );
131
+	private function register_constants($file) {
132
+		$this->share('url', plugin_dir_url($file));
133
+		$this->share('path', plugin_dir_path($file));
134
+		$this->share('basename', $basename = plugin_basename($file));
135
+		$this->share('slug', dirname($basename));
136
+		$this->share('version', static::VERSION);
137 137
 	}
138 138
 
139 139
 	/**
140 140
 	 * Registers the built-in services with the Application container.
141 141
 	 */
142 142
 	private function register_core_services() {
143
-		$this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) {
144
-			return new Loader( $app );
143
+		$this->share(array('loader' => 'Intraxia\Jaxion\Contract\Core\Loader'), function($app) {
144
+			return new Loader($app);
145 145
 		} );
146 146
 	}
147 147
 
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	private function load_i18n() {
152 152
 		load_plugin_textdomain(
153
-			$this->fetch( 'basename' ),
153
+			$this->fetch('basename'),
154 154
 			false,
155
-			basename( $this->fetch( 'path' ) ) . '/languages/'
155
+			basename($this->fetch('path')) . '/languages/'
156 156
 		);
157 157
 	}
158 158
 }
Please login to merge, or discard this patch.
src/Axolotl/Repository/WordPressTerm.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -13,130 +13,130 @@
 block discarded – undo
13 13
  * @subpackage Axolotl\Repository
14 14
  */
15 15
 class WordPressTerm extends AbstractWordPress {
16
-	/**
17
-	 * {@inheritDoc}
18
-	 *
19
-	 * @param int $id
20
-	 *
21
-	 * @return WP_Term|false
22
-	 */
23
-	protected function get_wp_object_by_id( $id ) {
24
-		$class = $this->class;
25
-
26
-		$term = get_term( $id, $class::get_taxonomy() );
27
-
28
-		if ( is_wp_error( $term ) ) {
29
-			return false;
30
-		}
31
-
32
-		return $term;
33
-	}
34
-
35
-	/**
36
-	 * {@inheritDoc}
37
-	 *
38
-	 * @param array $params
39
-	 *
40
-	 * @return WP_Term[]
41
-	 */
42
-	protected function get_wp_objects_by_params( $params ) {
43
-		$class = $this->class;
44
-
45
-		return get_terms( $class::get_taxonomy(), $params );
46
-	}
47
-
48
-	/**
49
-	 * {@inheritDoc}
50
-	 *
51
-	 * @param Model $model
52
-	 */
53
-	protected function fill_table_attrs_from_meta( Model $model ) {
54
-		$model->unguard();
55
-
56
-		if ( $model instanceof UsesWordPressTerm ) {
57
-			foreach ( $model->get_table_keys() as $key ) {
58
-				$model->set_attribute(
59
-					$key,
60
-					get_term_meta(
61
-						$model->get_primary_id(),
62
-						$this->make_meta_key( $key ),
63
-						true
64
-					)
65
-				);
66
-			}
67
-		}
68
-
69
-		$model->reguard();
70
-	}
71
-
72
-	/**
73
-	 * {@inheritDoc}
74
-	 *
75
-	 * @param Model $model
76
-	 *
77
-	 * @return int|WP_Error
78
-	 */
79
-	protected function save_wp_object( Model $model ) {
80
-		$class = $this->class;
81
-		$object = $model->get_underlying_wp_object();
82
-
83
-		$term_id = $object->term_id;
84
-		unset( $object->term_id );
85
-
86
-		$result  = wp_update_term(
87
-			$term_id,
88
-			$class::get_taxonomy(),
89
-			(array) $object
90
-		);
91
-
92
-		if ( is_wp_error( $result ) ) {
93
-			return $result;
94
-		}
95
-
96
-		return $result['term_id'];
97
-	}
98
-
99
-	/**
100
-	 * {@inheritDoc}
101
-	 *
102
-	 * @param Model $model
103
-	 */
104
-	protected function save_table_attributes_to_meta( Model $model ) {
105
-		foreach ( $model->get_changed_table_attributes() as $attribute => $value ) {
106
-			update_term_meta(
107
-				$model->get_primary_id(),
108
-				$this->make_meta_key( $attribute ),
109
-				$value
110
-			);
111
-		}
112
-	}
113
-
114
-	/**
115
-	 * {@inheritDoc}
116
-	 *
117
-	 * @param Model $model
118
-	 * @param bool  $force
119
-	 */
120
-	protected function delete_wp_object( Model $model, $force = false ) {
121
-		$class = $this->class;
122
-
123
-		wp_delete_term(
124
-			$model->get_primary_id(),
125
-			$class::get_taxonomy()
126
-		);
127
-	}
128
-
129
-	/**
130
-	 * {@inheritDoc}
131
-	 *
132
-	 * @param Model $model
133
-	 */
134
-	protected function delete_table_attributes_from_meta( Model $model ) {
135
-		foreach ( $model->get_table_attributes() as $attribute ) {
136
-			delete_term_meta(
137
-				$model->get_primary_id(),
138
-				$this->make_meta_key( $attribute )
139
-			);
140
-		}
141
-	}
16
+    /**
17
+     * {@inheritDoc}
18
+     *
19
+     * @param int $id
20
+     *
21
+     * @return WP_Term|false
22
+     */
23
+    protected function get_wp_object_by_id( $id ) {
24
+        $class = $this->class;
25
+
26
+        $term = get_term( $id, $class::get_taxonomy() );
27
+
28
+        if ( is_wp_error( $term ) ) {
29
+            return false;
30
+        }
31
+
32
+        return $term;
33
+    }
34
+
35
+    /**
36
+     * {@inheritDoc}
37
+     *
38
+     * @param array $params
39
+     *
40
+     * @return WP_Term[]
41
+     */
42
+    protected function get_wp_objects_by_params( $params ) {
43
+        $class = $this->class;
44
+
45
+        return get_terms( $class::get_taxonomy(), $params );
46
+    }
47
+
48
+    /**
49
+     * {@inheritDoc}
50
+     *
51
+     * @param Model $model
52
+     */
53
+    protected function fill_table_attrs_from_meta( Model $model ) {
54
+        $model->unguard();
55
+
56
+        if ( $model instanceof UsesWordPressTerm ) {
57
+            foreach ( $model->get_table_keys() as $key ) {
58
+                $model->set_attribute(
59
+                    $key,
60
+                    get_term_meta(
61
+                        $model->get_primary_id(),
62
+                        $this->make_meta_key( $key ),
63
+                        true
64
+                    )
65
+                );
66
+            }
67
+        }
68
+
69
+        $model->reguard();
70
+    }
71
+
72
+    /**
73
+     * {@inheritDoc}
74
+     *
75
+     * @param Model $model
76
+     *
77
+     * @return int|WP_Error
78
+     */
79
+    protected function save_wp_object( Model $model ) {
80
+        $class = $this->class;
81
+        $object = $model->get_underlying_wp_object();
82
+
83
+        $term_id = $object->term_id;
84
+        unset( $object->term_id );
85
+
86
+        $result  = wp_update_term(
87
+            $term_id,
88
+            $class::get_taxonomy(),
89
+            (array) $object
90
+        );
91
+
92
+        if ( is_wp_error( $result ) ) {
93
+            return $result;
94
+        }
95
+
96
+        return $result['term_id'];
97
+    }
98
+
99
+    /**
100
+     * {@inheritDoc}
101
+     *
102
+     * @param Model $model
103
+     */
104
+    protected function save_table_attributes_to_meta( Model $model ) {
105
+        foreach ( $model->get_changed_table_attributes() as $attribute => $value ) {
106
+            update_term_meta(
107
+                $model->get_primary_id(),
108
+                $this->make_meta_key( $attribute ),
109
+                $value
110
+            );
111
+        }
112
+    }
113
+
114
+    /**
115
+     * {@inheritDoc}
116
+     *
117
+     * @param Model $model
118
+     * @param bool  $force
119
+     */
120
+    protected function delete_wp_object( Model $model, $force = false ) {
121
+        $class = $this->class;
122
+
123
+        wp_delete_term(
124
+            $model->get_primary_id(),
125
+            $class::get_taxonomy()
126
+        );
127
+    }
128
+
129
+    /**
130
+     * {@inheritDoc}
131
+     *
132
+     * @param Model $model
133
+     */
134
+    protected function delete_table_attributes_from_meta( Model $model ) {
135
+        foreach ( $model->get_table_attributes() as $attribute ) {
136
+            delete_term_meta(
137
+                $model->get_primary_id(),
138
+                $this->make_meta_key( $attribute )
139
+            );
140
+        }
141
+    }
142 142
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return WP_Term|false
22 22
 	 */
23
-	protected function get_wp_object_by_id( $id ) {
23
+	protected function get_wp_object_by_id($id) {
24 24
 		$class = $this->class;
25 25
 
26
-		$term = get_term( $id, $class::get_taxonomy() );
26
+		$term = get_term($id, $class::get_taxonomy());
27 27
 
28
-		if ( is_wp_error( $term ) ) {
28
+		if (is_wp_error($term)) {
29 29
 			return false;
30 30
 		}
31 31
 
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return WP_Term[]
41 41
 	 */
42
-	protected function get_wp_objects_by_params( $params ) {
42
+	protected function get_wp_objects_by_params($params) {
43 43
 		$class = $this->class;
44 44
 
45
-		return get_terms( $class::get_taxonomy(), $params );
45
+		return get_terms($class::get_taxonomy(), $params);
46 46
 	}
47 47
 
48 48
 	/**
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param Model $model
52 52
 	 */
53
-	protected function fill_table_attrs_from_meta( Model $model ) {
53
+	protected function fill_table_attrs_from_meta(Model $model) {
54 54
 		$model->unguard();
55 55
 
56
-		if ( $model instanceof UsesWordPressTerm ) {
57
-			foreach ( $model->get_table_keys() as $key ) {
56
+		if ($model instanceof UsesWordPressTerm) {
57
+			foreach ($model->get_table_keys() as $key) {
58 58
 				$model->set_attribute(
59 59
 					$key,
60 60
 					get_term_meta(
61 61
 						$model->get_primary_id(),
62
-						$this->make_meta_key( $key ),
62
+						$this->make_meta_key($key),
63 63
 						true
64 64
 					)
65 65
 				);
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return int|WP_Error
78 78
 	 */
79
-	protected function save_wp_object( Model $model ) {
79
+	protected function save_wp_object(Model $model) {
80 80
 		$class = $this->class;
81 81
 		$object = $model->get_underlying_wp_object();
82 82
 
83 83
 		$term_id = $object->term_id;
84
-		unset( $object->term_id );
84
+		unset($object->term_id);
85 85
 
86 86
 		$result  = wp_update_term(
87 87
 			$term_id,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			(array) $object
90 90
 		);
91 91
 
92
-		if ( is_wp_error( $result ) ) {
92
+		if (is_wp_error($result)) {
93 93
 			return $result;
94 94
 		}
95 95
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @param Model $model
103 103
 	 */
104
-	protected function save_table_attributes_to_meta( Model $model ) {
105
-		foreach ( $model->get_changed_table_attributes() as $attribute => $value ) {
104
+	protected function save_table_attributes_to_meta(Model $model) {
105
+		foreach ($model->get_changed_table_attributes() as $attribute => $value) {
106 106
 			update_term_meta(
107 107
 				$model->get_primary_id(),
108
-				$this->make_meta_key( $attribute ),
108
+				$this->make_meta_key($attribute),
109 109
 				$value
110 110
 			);
111 111
 		}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param Model $model
118 118
 	 * @param bool  $force
119 119
 	 */
120
-	protected function delete_wp_object( Model $model, $force = false ) {
120
+	protected function delete_wp_object(Model $model, $force = false) {
121 121
 		$class = $this->class;
122 122
 
123 123
 		wp_delete_term(
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @param Model $model
133 133
 	 */
134
-	protected function delete_table_attributes_from_meta( Model $model ) {
135
-		foreach ( $model->get_table_attributes() as $attribute ) {
134
+	protected function delete_table_attributes_from_meta(Model $model) {
135
+		foreach ($model->get_table_attributes() as $attribute) {
136 136
 			delete_term_meta(
137 137
 				$model->get_primary_id(),
138
-				$this->make_meta_key( $attribute )
138
+				$this->make_meta_key($attribute)
139 139
 			);
140 140
 		}
141 141
 	}
Please login to merge, or discard this patch.
src/Axolotl/Repository/WordPressPost.php 2 patches
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -17,166 +17,166 @@
 block discarded – undo
17 17
  * @subpackage Axolotl\Repository
18 18
  */
19 19
 class WordPressPost extends AbstractWordPress {
20
-	/**
21
-	 * {@inheritDoc}
22
-	 *
23
-	 * @param int $id
24
-	 *
25
-	 * @return WP_Post|false
26
-	 */
27
-	protected function get_wp_object_by_id( $id ) {
28
-		$args = array_merge( $this->get_wp_query_args(), array(
29
-			'p' => (int) $id,
30
-		) );
31
-
32
-		$object = $this->main->query( $args );
33
-
34
-		if ( ! $object ) {
35
-			return false;
36
-		}
37
-
38
-		return $object[0];
39
-	}
40
-
41
-	/**
42
-	 * {@inheritDoc}
43
-	 *
44
-	 * @param array $params
45
-	 *
46
-	 * @return WP_Post[]
47
-	 */
48
-	protected function get_wp_objects_by_params( $params ) {
49
-		$args = array_merge(
50
-			$this->get_wp_query_args(),
51
-			$params
52
-		);
53
-
54
-		return $this->main->query( $args );
55
-	}
56
-
57
-	/**
58
-	 * {@inheritDoc}
59
-	 *
60
-	 * @param Model $model
61
-	 */
62
-	protected function fill_table_attrs_from_meta( Model $model ) {
63
-		$model->unguard();
64
-
65
-		if ( $model instanceof UsesWordPressPost ) {
66
-			foreach ( $model->get_table_keys() as $key ) {
67
-				$model->set_attribute(
68
-					$key,
69
-					get_post_meta(
70
-						$model->get_primary_id(),
71
-						$this->make_meta_key( $key ),
72
-						true
73
-					)
74
-				);
75
-			}
76
-		}
77
-
78
-		$model->reguard();
79
-	}
80
-
81
-	/**
82
-	 * Retrieves the default query args for the provided class.
83
-	 *
84
-	 * @return array
85
-	 */
86
-	protected function get_wp_query_args() {
87
-		$class = $this->class;
88
-
89
-		$args = array(
90
-			'post_type'   => $class::get_post_type(),
91
-		);
92
-
93
-		/**
94
-		 * Model object.
95
-		 *
96
-		 * @var Model $model
97
-		 */
98
-		$model = new $this->class;
99
-
100
-		foreach ( $model->get_related_keys() as $related_key ) {
101
-			/**
102
-			 * Relation object.
103
-			 *
104
-			 * @var Root $relation
105
-			 */
106
-			$relation = $model->{"related_{$related_key}"}();
107
-
108
-			if ( $relation instanceof HasMany &&
109
-			     $relation->get_relationship_type() === 'post_post' &&
110
-			     $relation->get_foreign_key() === 'post_parent'
111
-			) {
112
-				$args['post_parent'] = 0;
113
-			}
114
-
115
-			if ( $relation instanceof BelongsToOne &&
116
-			     $relation->get_relationship_type() === 'post_post' &&
117
-			     $relation->get_local_key() === 'post_parent'
118
-			) {
119
-				$args['post_parent__not_in'] = array( 0 );
120
-			}
121
-		}
122
-
123
-		return $args;
124
-	}
125
-
126
-	/**
127
-	 * {@inheritDoc}
128
-	 *
129
-	 * @param Model $model
130
-	 *
131
-	 * @return int|WP_Error
132
-	 */
133
-	protected function save_wp_object( Model $model ) {
134
-		$object = $model->get_underlying_wp_object();
135
-
136
-		return isset( $object->ID ) ?
137
-			wp_update_post( $object, true ) :
138
-			wp_insert_post( $object->to_array(), true );
139
-	}
140
-
141
-	/**
142
-	 * {@inheritDoc}
143
-	 *
144
-	 * @param Model $model
145
-	 */
146
-	protected function save_table_attributes_to_meta( Model $model ) {
147
-		foreach ( $model->get_changed_table_attributes() as $attribute => $value ) {
148
-			update_post_meta(
149
-				$model->get_primary_id(),
150
-				$this->make_meta_key( $attribute ),
151
-				$value
152
-			);
153
-		}
154
-	}
155
-
156
-	/**
157
-	 * {@inheritdoc}
158
-	 *
159
-	 * @param Model $model
160
-	 * @param bool  $force
161
-	 */
162
-	protected function delete_wp_object( Model $model, $force = false ) {
163
-		wp_delete_post(
164
-			$model->get_primary_id(),
165
-			$force
166
-		);
167
-	}
168
-
169
-	/**
170
-	 * {@inheritdoc}
171
-	 *
172
-	 * @param Model $model
173
-	 */
174
-	protected function delete_table_attributes_from_meta( Model $model ) {
175
-		foreach ( $model->get_table_keys() as $key ) {
176
-			delete_post_meta(
177
-				$model->get_primary_id(),
178
-				$key
179
-			);
180
-		}
181
-	}
20
+    /**
21
+     * {@inheritDoc}
22
+     *
23
+     * @param int $id
24
+     *
25
+     * @return WP_Post|false
26
+     */
27
+    protected function get_wp_object_by_id( $id ) {
28
+        $args = array_merge( $this->get_wp_query_args(), array(
29
+            'p' => (int) $id,
30
+        ) );
31
+
32
+        $object = $this->main->query( $args );
33
+
34
+        if ( ! $object ) {
35
+            return false;
36
+        }
37
+
38
+        return $object[0];
39
+    }
40
+
41
+    /**
42
+     * {@inheritDoc}
43
+     *
44
+     * @param array $params
45
+     *
46
+     * @return WP_Post[]
47
+     */
48
+    protected function get_wp_objects_by_params( $params ) {
49
+        $args = array_merge(
50
+            $this->get_wp_query_args(),
51
+            $params
52
+        );
53
+
54
+        return $this->main->query( $args );
55
+    }
56
+
57
+    /**
58
+     * {@inheritDoc}
59
+     *
60
+     * @param Model $model
61
+     */
62
+    protected function fill_table_attrs_from_meta( Model $model ) {
63
+        $model->unguard();
64
+
65
+        if ( $model instanceof UsesWordPressPost ) {
66
+            foreach ( $model->get_table_keys() as $key ) {
67
+                $model->set_attribute(
68
+                    $key,
69
+                    get_post_meta(
70
+                        $model->get_primary_id(),
71
+                        $this->make_meta_key( $key ),
72
+                        true
73
+                    )
74
+                );
75
+            }
76
+        }
77
+
78
+        $model->reguard();
79
+    }
80
+
81
+    /**
82
+     * Retrieves the default query args for the provided class.
83
+     *
84
+     * @return array
85
+     */
86
+    protected function get_wp_query_args() {
87
+        $class = $this->class;
88
+
89
+        $args = array(
90
+            'post_type'   => $class::get_post_type(),
91
+        );
92
+
93
+        /**
94
+         * Model object.
95
+         *
96
+         * @var Model $model
97
+         */
98
+        $model = new $this->class;
99
+
100
+        foreach ( $model->get_related_keys() as $related_key ) {
101
+            /**
102
+             * Relation object.
103
+             *
104
+             * @var Root $relation
105
+             */
106
+            $relation = $model->{"related_{$related_key}"}();
107
+
108
+            if ( $relation instanceof HasMany &&
109
+                 $relation->get_relationship_type() === 'post_post' &&
110
+                 $relation->get_foreign_key() === 'post_parent'
111
+            ) {
112
+                $args['post_parent'] = 0;
113
+            }
114
+
115
+            if ( $relation instanceof BelongsToOne &&
116
+                 $relation->get_relationship_type() === 'post_post' &&
117
+                 $relation->get_local_key() === 'post_parent'
118
+            ) {
119
+                $args['post_parent__not_in'] = array( 0 );
120
+            }
121
+        }
122
+
123
+        return $args;
124
+    }
125
+
126
+    /**
127
+     * {@inheritDoc}
128
+     *
129
+     * @param Model $model
130
+     *
131
+     * @return int|WP_Error
132
+     */
133
+    protected function save_wp_object( Model $model ) {
134
+        $object = $model->get_underlying_wp_object();
135
+
136
+        return isset( $object->ID ) ?
137
+            wp_update_post( $object, true ) :
138
+            wp_insert_post( $object->to_array(), true );
139
+    }
140
+
141
+    /**
142
+     * {@inheritDoc}
143
+     *
144
+     * @param Model $model
145
+     */
146
+    protected function save_table_attributes_to_meta( Model $model ) {
147
+        foreach ( $model->get_changed_table_attributes() as $attribute => $value ) {
148
+            update_post_meta(
149
+                $model->get_primary_id(),
150
+                $this->make_meta_key( $attribute ),
151
+                $value
152
+            );
153
+        }
154
+    }
155
+
156
+    /**
157
+     * {@inheritdoc}
158
+     *
159
+     * @param Model $model
160
+     * @param bool  $force
161
+     */
162
+    protected function delete_wp_object( Model $model, $force = false ) {
163
+        wp_delete_post(
164
+            $model->get_primary_id(),
165
+            $force
166
+        );
167
+    }
168
+
169
+    /**
170
+     * {@inheritdoc}
171
+     *
172
+     * @param Model $model
173
+     */
174
+    protected function delete_table_attributes_from_meta( Model $model ) {
175
+        foreach ( $model->get_table_keys() as $key ) {
176
+            delete_post_meta(
177
+                $model->get_primary_id(),
178
+                $key
179
+            );
180
+        }
181
+    }
182 182
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -25 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @return WP_Post|false
26 26
 	 */
27
-	protected function get_wp_object_by_id( $id ) {
28
-		$args = array_merge( $this->get_wp_query_args(), array(
27
+	protected function get_wp_object_by_id($id) {
28
+		$args = array_merge($this->get_wp_query_args(), array(
29 29
 			'p' => (int) $id,
30
-		) );
30
+		));
31 31
 
32
-		$object = $this->main->query( $args );
32
+		$object = $this->main->query($args);
33 33
 
34
-		if ( ! $object ) {
34
+		if (!$object) {
35 35
 			return false;
36 36
 		}
37 37
 
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return WP_Post[]
47 47
 	 */
48
-	protected function get_wp_objects_by_params( $params ) {
48
+	protected function get_wp_objects_by_params($params) {
49 49
 		$args = array_merge(
50 50
 			$this->get_wp_query_args(),
51 51
 			$params
52 52
 		);
53 53
 
54
-		return $this->main->query( $args );
54
+		return $this->main->query($args);
55 55
 	}
56 56
 
57 57
 	/**
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param Model $model
61 61
 	 */
62
-	protected function fill_table_attrs_from_meta( Model $model ) {
62
+	protected function fill_table_attrs_from_meta(Model $model) {
63 63
 		$model->unguard();
64 64
 
65
-		if ( $model instanceof UsesWordPressPost ) {
66
-			foreach ( $model->get_table_keys() as $key ) {
65
+		if ($model instanceof UsesWordPressPost) {
66
+			foreach ($model->get_table_keys() as $key) {
67 67
 				$model->set_attribute(
68 68
 					$key,
69 69
 					get_post_meta(
70 70
 						$model->get_primary_id(),
71
-						$this->make_meta_key( $key ),
71
+						$this->make_meta_key($key),
72 72
 						true
73 73
 					)
74 74
 				);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		 */
98 98
 		$model = new $this->class;
99 99
 
100
-		foreach ( $model->get_related_keys() as $related_key ) {
100
+		foreach ($model->get_related_keys() as $related_key) {
101 101
 			/**
102 102
 			 * Relation object.
103 103
 			 *
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 			 */
106 106
 			$relation = $model->{"related_{$related_key}"}();
107 107
 
108
-			if ( $relation instanceof HasMany &&
108
+			if ($relation instanceof HasMany &&
109 109
 			     $relation->get_relationship_type() === 'post_post' &&
110 110
 			     $relation->get_foreign_key() === 'post_parent'
111 111
 			) {
112 112
 				$args['post_parent'] = 0;
113 113
 			}
114 114
 
115
-			if ( $relation instanceof BelongsToOne &&
115
+			if ($relation instanceof BelongsToOne &&
116 116
 			     $relation->get_relationship_type() === 'post_post' &&
117 117
 			     $relation->get_local_key() === 'post_parent'
118 118
 			) {
119
-				$args['post_parent__not_in'] = array( 0 );
119
+				$args['post_parent__not_in'] = array(0);
120 120
 			}
121 121
 		}
122 122
 
@@ -130,12 +130,11 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return int|WP_Error
132 132
 	 */
133
-	protected function save_wp_object( Model $model ) {
133
+	protected function save_wp_object(Model $model) {
134 134
 		$object = $model->get_underlying_wp_object();
135 135
 
136
-		return isset( $object->ID ) ?
137
-			wp_update_post( $object, true ) :
138
-			wp_insert_post( $object->to_array(), true );
136
+		return isset($object->ID) ?
137
+			wp_update_post($object, true) : wp_insert_post($object->to_array(), true);
139 138
 	}
140 139
 
141 140
 	/**
@@ -143,11 +142,11 @@  discard block
 block discarded – undo
143 142
 	 *
144 143
 	 * @param Model $model
145 144
 	 */
146
-	protected function save_table_attributes_to_meta( Model $model ) {
147
-		foreach ( $model->get_changed_table_attributes() as $attribute => $value ) {
145
+	protected function save_table_attributes_to_meta(Model $model) {
146
+		foreach ($model->get_changed_table_attributes() as $attribute => $value) {
148 147
 			update_post_meta(
149 148
 				$model->get_primary_id(),
150
-				$this->make_meta_key( $attribute ),
149
+				$this->make_meta_key($attribute),
151 150
 				$value
152 151
 			);
153 152
 		}
@@ -159,7 +158,7 @@  discard block
 block discarded – undo
159 158
 	 * @param Model $model
160 159
 	 * @param bool  $force
161 160
 	 */
162
-	protected function delete_wp_object( Model $model, $force = false ) {
161
+	protected function delete_wp_object(Model $model, $force = false) {
163 162
 		wp_delete_post(
164 163
 			$model->get_primary_id(),
165 164
 			$force
@@ -171,8 +170,8 @@  discard block
 block discarded – undo
171 170
 	 *
172 171
 	 * @param Model $model
173 172
 	 */
174
-	protected function delete_table_attributes_from_meta( Model $model ) {
175
-		foreach ( $model->get_table_keys() as $key ) {
173
+	protected function delete_table_attributes_from_meta(Model $model) {
174
+		foreach ($model->get_table_keys() as $key) {
176 175
 			delete_post_meta(
177 176
 				$model->get_primary_id(),
178 177
 				$key
Please login to merge, or discard this patch.
src/Axolotl/Relationship/HasMany.php 2 patches
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -12,113 +12,113 @@
 block discarded – undo
12 12
  * @subpackage Axolotl\Relationship
13 13
  */
14 14
 class HasMany extends Root {
15
-	/**
16
-	 * Relationship's primary key name
17
-	 * on related model.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $foreign_key = '';
15
+    /**
16
+     * Relationship's primary key name
17
+     * on related model.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $foreign_key = '';
22 22
 
23
-	/**
24
-	 * HasMany constructor.
25
-	 *
26
-	 * @param Model  $model
27
-	 * @param string $class
28
-	 * @param string $type
29
-	 * @param string $foreign_key
30
-	 */
31
-	public function __construct( Model $model, $class, $type, $foreign_key ) {
32
-		$this->foreign_key = $foreign_key;
23
+    /**
24
+     * HasMany constructor.
25
+     *
26
+     * @param Model  $model
27
+     * @param string $class
28
+     * @param string $type
29
+     * @param string $foreign_key
30
+     */
31
+    public function __construct( Model $model, $class, $type, $foreign_key ) {
32
+        $this->foreign_key = $foreign_key;
33 33
 
34
-		parent::__construct( $model, $class, $type );
35
-	}
34
+        parent::__construct( $model, $class, $type );
35
+    }
36 36
 
37
-	/**
38
-	 * {@inheritDoc}
39
-	 *
40
-	 * @param EntityManager $database
41
-	 *
42
-	 * @throws LogicException
43
-	 */
44
-	public function attach_relation( EntityManager $database ) {
45
-		if ( $this->get_model()->is_filling() ) {
46
-			return;
47
-		}
37
+    /**
38
+     * {@inheritDoc}
39
+     *
40
+     * @param EntityManager $database
41
+     *
42
+     * @throws LogicException
43
+     */
44
+    public function attach_relation( EntityManager $database ) {
45
+        if ( $this->get_model()->is_filling() ) {
46
+            return;
47
+        }
48 48
 
49
-		$this->get_model()->set_filling( true );
49
+        $this->get_model()->set_filling( true );
50 50
 
51
-		switch ( $this->get_type() ) {
52
-			case 'object':
53
-				$target = $database->find_by(
54
-					$this->get_class(),
55
-					$this->make_target_params()
56
-				);
57
-				break;
58
-			case 'table': // @todo implement
59
-			default:
60
-				throw new LogicException;
61
-		}
51
+        switch ( $this->get_type() ) {
52
+            case 'object':
53
+                $target = $database->find_by(
54
+                    $this->get_class(),
55
+                    $this->make_target_params()
56
+                );
57
+                break;
58
+            case 'table': // @todo implement
59
+            default:
60
+                throw new LogicException;
61
+        }
62 62
 
63
-		$this->set_target( $target );
63
+        $this->set_target( $target );
64 64
 
65
-		$this->get_model()->set_filling( false );
66
-	}
65
+        $this->get_model()->set_filling( false );
66
+    }
67 67
 
68
-	/**
69
-	 * {@inheritDoc}
70
-	 *
71
-	 * @return string
72
-	 */
73
-	public function get_sha() {
74
-		return sha1(
75
-			__CLASS__ .
76
-			get_class( $this->model ) .
77
-			$this->class .
78
-			$this->type .
79
-			$this->foreign_key
80
-		);
81
-	}
68
+    /**
69
+     * {@inheritDoc}
70
+     *
71
+     * @return string
72
+     */
73
+    public function get_sha() {
74
+        return sha1(
75
+            __CLASS__ .
76
+            get_class( $this->model ) .
77
+            $this->class .
78
+            $this->type .
79
+            $this->foreign_key
80
+        );
81
+    }
82 82
 
83
-	/**
84
-	 * Gets the relationship's foreign key.
85
-	 *
86
-	 * @return string
87
-	 */
88
-	public function get_foreign_key() {
89
-		return $this->foreign_key;
90
-	}
83
+    /**
84
+     * Gets the relationship's foreign key.
85
+     *
86
+     * @return string
87
+     */
88
+    public function get_foreign_key() {
89
+        return $this->foreign_key;
90
+    }
91 91
 
92
-	/**
93
-	 * Gets the params required for the EntityManager to find the target models.
94
-	 *
95
-	 * @return array
96
-	 *
97
-	 * @throws LogicException
98
-	 */
99
-	protected function make_target_params() {
100
-		switch ( $this->get_relationship_type() ) {
101
-			case 'post_post':
102
-				return array(
103
-					$this->foreign_key => $this->get_model()->get_primary_id(),
104
-					'nopaging'         => true,
105
-				);
106
-			case 'post_term':
107
-				return array();
108
-			case 'term_post':
109
-				$model = $this->get_model();
110
-				return array(
111
-					'nopaging'  => true,
112
-					'tax_query' => array(
113
-						array(
114
-							'taxonomy' => $model::get_taxonomy(),
115
-							'field'    => 'term_id',
116
-							'terms'    => $model->get_primary_id(),
117
-						),
118
-					),
119
-				);
120
-			default:
121
-				throw new LogicException;
122
-		}
123
-	}
92
+    /**
93
+     * Gets the params required for the EntityManager to find the target models.
94
+     *
95
+     * @return array
96
+     *
97
+     * @throws LogicException
98
+     */
99
+    protected function make_target_params() {
100
+        switch ( $this->get_relationship_type() ) {
101
+            case 'post_post':
102
+                return array(
103
+                    $this->foreign_key => $this->get_model()->get_primary_id(),
104
+                    'nopaging'         => true,
105
+                );
106
+            case 'post_term':
107
+                return array();
108
+            case 'term_post':
109
+                $model = $this->get_model();
110
+                return array(
111
+                    'nopaging'  => true,
112
+                    'tax_query' => array(
113
+                        array(
114
+                            'taxonomy' => $model::get_taxonomy(),
115
+                            'field'    => 'term_id',
116
+                            'terms'    => $model->get_primary_id(),
117
+                        ),
118
+                    ),
119
+                );
120
+            default:
121
+                throw new LogicException;
122
+        }
123
+    }
124 124
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 	 * @param string $type
29 29
 	 * @param string $foreign_key
30 30
 	 */
31
-	public function __construct( Model $model, $class, $type, $foreign_key ) {
31
+	public function __construct(Model $model, $class, $type, $foreign_key) {
32 32
 		$this->foreign_key = $foreign_key;
33 33
 
34
-		parent::__construct( $model, $class, $type );
34
+		parent::__construct($model, $class, $type);
35 35
 	}
36 36
 
37 37
 	/**
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @throws LogicException
43 43
 	 */
44
-	public function attach_relation( EntityManager $database ) {
45
-		if ( $this->get_model()->is_filling() ) {
44
+	public function attach_relation(EntityManager $database) {
45
+		if ($this->get_model()->is_filling()) {
46 46
 			return;
47 47
 		}
48 48
 
49
-		$this->get_model()->set_filling( true );
49
+		$this->get_model()->set_filling(true);
50 50
 
51
-		switch ( $this->get_type() ) {
51
+		switch ($this->get_type()) {
52 52
 			case 'object':
53 53
 				$target = $database->find_by(
54 54
 					$this->get_class(),
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 				throw new LogicException;
61 61
 		}
62 62
 
63
-		$this->set_target( $target );
63
+		$this->set_target($target);
64 64
 
65
-		$this->get_model()->set_filling( false );
65
+		$this->get_model()->set_filling(false);
66 66
 	}
67 67
 
68 68
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	public function get_sha() {
74 74
 		return sha1(
75 75
 			__CLASS__ .
76
-			get_class( $this->model ) .
76
+			get_class($this->model) .
77 77
 			$this->class .
78 78
 			$this->type .
79 79
 			$this->foreign_key
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @throws LogicException
98 98
 	 */
99 99
 	protected function make_target_params() {
100
-		switch ( $this->get_relationship_type() ) {
100
+		switch ($this->get_relationship_type()) {
101 101
 			case 'post_post':
102 102
 				return array(
103 103
 					$this->foreign_key => $this->get_model()->get_primary_id(),
Please login to merge, or discard this patch.
src/Axolotl/Relationship/Root.php 2 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -18,126 +18,126 @@
 block discarded – undo
18 18
  * @subpackage Axolotl\Relationship
19 19
  */
20 20
 abstract class Root {
21
-	/**
22
-	 * Model the relationship is on.
23
-	 *
24
-	 * @var Model
25
-	 */
26
-	protected $model;
27
-
28
-	/**
29
-	 * Class name the Model is related to.
30
-	 *
31
-	 * @var string
32
-	 */
33
-	protected $class;
34
-
35
-	/**
36
-	 * Whether the Relationship is by object or model.
37
-	 *
38
-	 * @var string
39
-	 */
40
-	protected $type;
41
-
42
-	/**
43
-	 * Root relationship constructor.
44
-	 *
45
-	 * @param Model  $model
46
-	 * @param string $class
47
-	 * @param string $type
48
-	 */
49
-	public function __construct( Model $model, $class, $type ) {
50
-		$this->model = $model;
51
-		$this->class = $class;
52
-		$this->type  = $type;
53
-	}
54
-
55
-	/**
56
-	 * Returns the relationship's Model.
57
-	 *
58
-	 * @return Model
59
-	 */
60
-	public function get_model() {
61
-		return $this->model;
62
-	}
63
-
64
-	/**
65
-	 * Returns the relationship's related class.
66
-	 *
67
-	 * @return string
68
-	 */
69
-	public function get_class() {
70
-		return $this->class;
71
-	}
72
-
73
-	/**
74
-	 * Returns whether the relation is on the object or table.
75
-	 *
76
-	 * @return string
77
-	 */
78
-	public function get_type() {
79
-		return $this->type;
80
-	}
81
-
82
-	/**
83
-	 * Sets the relationship target on the model.
84
-	 *
85
-	 * @param Model|Collection $target
86
-	 */
87
-	public function set_target( $target ) {
88
-		$this->get_model()->set_related( $this->get_sha(), $target );
89
-	}
90
-
91
-	/**
92
-	 * Returns the relationship type between source and destination Model.
93
-	 *
94
-	 * @return string {source}_{dest}
95
-	 */
96
-	public function get_relationship_type() {
97
-		$relationship = '';
98
-
99
-		if ( $this->get_model() instanceof UsesWordPressPost ) {
100
-			$relationship .= 'post';
101
-		} elseif ( $this->get_model() instanceof UsesWordPressTerm ) {
102
-			$relationship .= 'term';
103
-		} elseif ( $this->get_model() instanceof UsesCustomTable ) {
104
-			$relationship .= 'table';
105
-		}
106
-
107
-		$relationship .= '_';
108
-
109
-		if ( is_subclass_of(
110
-			$this->get_class(),
111
-			'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressPost'
112
-		) ) {
113
-			$relationship .= 'post';
114
-		} elseif ( is_subclass_of(
115
-			$this->get_class(),
116
-			'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressTerm'
117
-		) ) {
118
-			$relationship .= 'term';
119
-		} elseif ( is_subclass_of(
120
-			$this->get_class(),
121
-			'Intraxia\Jaxion\Contract\Axolotl\UsesCustomTable'
122
-		) ) {
123
-			$relationship .= 'table';
124
-		}
125
-
126
-		return $relationship;
127
-	}
128
-
129
-	/**
130
-	 * Returns the query args to
131
-	 * fetch the provided relation.
132
-	 *
133
-	 * @param EntityManager $database
134
-	 */
135
-	abstract public function attach_relation( EntityManager $database );
136
-
137
-	/**
138
-	 * Generate the sha for the relation.
139
-	 *
140
-	 * @return string
141
-	 */
142
-	abstract public function get_sha();
21
+    /**
22
+     * Model the relationship is on.
23
+     *
24
+     * @var Model
25
+     */
26
+    protected $model;
27
+
28
+    /**
29
+     * Class name the Model is related to.
30
+     *
31
+     * @var string
32
+     */
33
+    protected $class;
34
+
35
+    /**
36
+     * Whether the Relationship is by object or model.
37
+     *
38
+     * @var string
39
+     */
40
+    protected $type;
41
+
42
+    /**
43
+     * Root relationship constructor.
44
+     *
45
+     * @param Model  $model
46
+     * @param string $class
47
+     * @param string $type
48
+     */
49
+    public function __construct( Model $model, $class, $type ) {
50
+        $this->model = $model;
51
+        $this->class = $class;
52
+        $this->type  = $type;
53
+    }
54
+
55
+    /**
56
+     * Returns the relationship's Model.
57
+     *
58
+     * @return Model
59
+     */
60
+    public function get_model() {
61
+        return $this->model;
62
+    }
63
+
64
+    /**
65
+     * Returns the relationship's related class.
66
+     *
67
+     * @return string
68
+     */
69
+    public function get_class() {
70
+        return $this->class;
71
+    }
72
+
73
+    /**
74
+     * Returns whether the relation is on the object or table.
75
+     *
76
+     * @return string
77
+     */
78
+    public function get_type() {
79
+        return $this->type;
80
+    }
81
+
82
+    /**
83
+     * Sets the relationship target on the model.
84
+     *
85
+     * @param Model|Collection $target
86
+     */
87
+    public function set_target( $target ) {
88
+        $this->get_model()->set_related( $this->get_sha(), $target );
89
+    }
90
+
91
+    /**
92
+     * Returns the relationship type between source and destination Model.
93
+     *
94
+     * @return string {source}_{dest}
95
+     */
96
+    public function get_relationship_type() {
97
+        $relationship = '';
98
+
99
+        if ( $this->get_model() instanceof UsesWordPressPost ) {
100
+            $relationship .= 'post';
101
+        } elseif ( $this->get_model() instanceof UsesWordPressTerm ) {
102
+            $relationship .= 'term';
103
+        } elseif ( $this->get_model() instanceof UsesCustomTable ) {
104
+            $relationship .= 'table';
105
+        }
106
+
107
+        $relationship .= '_';
108
+
109
+        if ( is_subclass_of(
110
+            $this->get_class(),
111
+            'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressPost'
112
+        ) ) {
113
+            $relationship .= 'post';
114
+        } elseif ( is_subclass_of(
115
+            $this->get_class(),
116
+            'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressTerm'
117
+        ) ) {
118
+            $relationship .= 'term';
119
+        } elseif ( is_subclass_of(
120
+            $this->get_class(),
121
+            'Intraxia\Jaxion\Contract\Axolotl\UsesCustomTable'
122
+        ) ) {
123
+            $relationship .= 'table';
124
+        }
125
+
126
+        return $relationship;
127
+    }
128
+
129
+    /**
130
+     * Returns the query args to
131
+     * fetch the provided relation.
132
+     *
133
+     * @param EntityManager $database
134
+     */
135
+    abstract public function attach_relation( EntityManager $database );
136
+
137
+    /**
138
+     * Generate the sha for the relation.
139
+     *
140
+     * @return string
141
+     */
142
+    abstract public function get_sha();
143 143
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param string $class
47 47
 	 * @param string $type
48 48
 	 */
49
-	public function __construct( Model $model, $class, $type ) {
49
+	public function __construct(Model $model, $class, $type) {
50 50
 		$this->model = $model;
51 51
 		$this->class = $class;
52 52
 		$this->type  = $type;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @param Model|Collection $target
86 86
 	 */
87
-	public function set_target( $target ) {
88
-		$this->get_model()->set_related( $this->get_sha(), $target );
87
+	public function set_target($target) {
88
+		$this->get_model()->set_related($this->get_sha(), $target);
89 89
 	}
90 90
 
91 91
 	/**
@@ -96,30 +96,30 @@  discard block
 block discarded – undo
96 96
 	public function get_relationship_type() {
97 97
 		$relationship = '';
98 98
 
99
-		if ( $this->get_model() instanceof UsesWordPressPost ) {
99
+		if ($this->get_model() instanceof UsesWordPressPost) {
100 100
 			$relationship .= 'post';
101
-		} elseif ( $this->get_model() instanceof UsesWordPressTerm ) {
101
+		} elseif ($this->get_model() instanceof UsesWordPressTerm) {
102 102
 			$relationship .= 'term';
103
-		} elseif ( $this->get_model() instanceof UsesCustomTable ) {
103
+		} elseif ($this->get_model() instanceof UsesCustomTable) {
104 104
 			$relationship .= 'table';
105 105
 		}
106 106
 
107 107
 		$relationship .= '_';
108 108
 
109
-		if ( is_subclass_of(
109
+		if (is_subclass_of(
110 110
 			$this->get_class(),
111 111
 			'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressPost'
112
-		) ) {
112
+		)) {
113 113
 			$relationship .= 'post';
114
-		} elseif ( is_subclass_of(
114
+		} elseif (is_subclass_of(
115 115
 			$this->get_class(),
116 116
 			'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressTerm'
117
-		) ) {
117
+		)) {
118 118
 			$relationship .= 'term';
119
-		} elseif ( is_subclass_of(
119
+		} elseif (is_subclass_of(
120 120
 			$this->get_class(),
121 121
 			'Intraxia\Jaxion\Contract\Axolotl\UsesCustomTable'
122
-		) ) {
122
+		)) {
123 123
 			$relationship .= 'table';
124 124
 		}
125 125
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param EntityManager $database
134 134
 	 */
135
-	abstract public function attach_relation( EntityManager $database );
135
+	abstract public function attach_relation(EntityManager $database);
136 136
 
137 137
 	/**
138 138
 	 * Generate the sha for the relation.
Please login to merge, or discard this patch.
src/Axolotl/Collection.php 2 patches
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -14,152 +14,152 @@
 block discarded – undo
14 14
  * @subpackage Axolotl
15 15
  */
16 16
 class Collection implements Countable, Iterator, Serializes {
17
-	/**
18
-	 * Collection elements.
19
-	 *
20
-	 * @var array
21
-	 */
22
-	protected $elements = array();
23
-
24
-	/**
25
-	 * Models registered to the collection.
26
-	 *
27
-	 * @var string
28
-	 */
29
-	protected $model;
30
-
31
-	/**
32
-	 * Where Collection is in loop.
33
-	 *
34
-	 * @var int
35
-	 */
36
-	protected $position = 0;
37
-
38
-	/**
39
-	 * Collection constructor.
40
-	 *
41
-	 * @param array $elements
42
-	 * @param array $config
43
-	 */
44
-	public function __construct( array $elements = array(), array $config = array() ) {
45
-		$this->parse_config( $config );
46
-
47
-		foreach ( $elements as $element ) {
48
-			$this->add( $element );
49
-		}
50
-	}
51
-
52
-	/**
53
-	 * Adds a new element to the Collection.
54
-	 *
55
-	 * @param mixed $element
56
-	 *
57
-	 * @throws RuntimeException
58
-	 */
59
-	public function add( $element ) {
60
-		if ( $this->model && is_array( $element ) ) {
61
-			$element = new $this->model( $element );
62
-		}
63
-
64
-		if ( $this->model && ! ( $element instanceof $this->model ) ) {
65
-			throw new RuntimeException;
66
-		}
67
-
68
-		$this->elements[] = $element;
69
-	}
70
-
71
-	/**
72
-	 * Fetches the element at the provided index.
73
-	 *
74
-	 * @param int $index
75
-	 *
76
-	 * @return mixed
77
-	 */
78
-	public function at( $index ) {
79
-		return $this->elements[ $index ];
80
-	}
81
-
82
-	/**
83
-	 * Return the current element.
84
-	 *
85
-	 * @return mixed
86
-	 */
87
-	public function current() {
88
-		return $this->at( $this->position );
89
-	}
90
-
91
-	/**
92
-	 * Move forward to next element.
93
-	 */
94
-	public function next() {
95
-		$this->position ++;
96
-	}
97
-
98
-	/**
99
-	 * Return the key of the current element.
100
-	 *
101
-	 * @return mixed
102
-	 */
103
-	public function key() {
104
-		return $this->position;
105
-	}
106
-
107
-	/**
108
-	 * Checks if current position is valid.
109
-	 *
110
-	 * @return bool
111
-	 */
112
-	public function valid() {
113
-		return isset( $this->elements[ $this->position ] );
114
-	}
115
-
116
-	/**
117
-	 * Rewind the Iterator to the first element.
118
-	 */
119
-	public function rewind() {
120
-		$this->position = 0;
121
-	}
122
-
123
-	/**
124
-	 * Count elements of an object.
125
-	 *
126
-	 * @return int
127
-	 */
128
-	public function count() {
129
-		return count( $this->elements );
130
-	}
131
-
132
-	/**
133
-	 * Parses the Collection config to set its properties.
134
-	 *
135
-	 * @param array $config
136
-	 *
137
-	 * @throws LogicException
138
-	 */
139
-	protected function parse_config( array $config ) {
140
-		if ( isset( $config['model'] ) ) {
141
-			$model = $config['model'];
142
-
143
-			if ( ! is_subclass_of( $model, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
144
-				throw new LogicException;
145
-			}
146
-
147
-			$this->model = $model;
148
-		}
149
-	}
150
-
151
-	/**
152
-	 * {@inheritDoc}
153
-	 *
154
-	 * @return array
155
-	 */
156
-	public function serialize() {
157
-		return array_map(function( $element ) {
158
-			if ( $element instanceof Serializes ) {
159
-				return $element->serialize();
160
-			}
161
-
162
-			return $element;
163
-		}, $this->elements);
164
-	}
17
+    /**
18
+     * Collection elements.
19
+     *
20
+     * @var array
21
+     */
22
+    protected $elements = array();
23
+
24
+    /**
25
+     * Models registered to the collection.
26
+     *
27
+     * @var string
28
+     */
29
+    protected $model;
30
+
31
+    /**
32
+     * Where Collection is in loop.
33
+     *
34
+     * @var int
35
+     */
36
+    protected $position = 0;
37
+
38
+    /**
39
+     * Collection constructor.
40
+     *
41
+     * @param array $elements
42
+     * @param array $config
43
+     */
44
+    public function __construct( array $elements = array(), array $config = array() ) {
45
+        $this->parse_config( $config );
46
+
47
+        foreach ( $elements as $element ) {
48
+            $this->add( $element );
49
+        }
50
+    }
51
+
52
+    /**
53
+     * Adds a new element to the Collection.
54
+     *
55
+     * @param mixed $element
56
+     *
57
+     * @throws RuntimeException
58
+     */
59
+    public function add( $element ) {
60
+        if ( $this->model && is_array( $element ) ) {
61
+            $element = new $this->model( $element );
62
+        }
63
+
64
+        if ( $this->model && ! ( $element instanceof $this->model ) ) {
65
+            throw new RuntimeException;
66
+        }
67
+
68
+        $this->elements[] = $element;
69
+    }
70
+
71
+    /**
72
+     * Fetches the element at the provided index.
73
+     *
74
+     * @param int $index
75
+     *
76
+     * @return mixed
77
+     */
78
+    public function at( $index ) {
79
+        return $this->elements[ $index ];
80
+    }
81
+
82
+    /**
83
+     * Return the current element.
84
+     *
85
+     * @return mixed
86
+     */
87
+    public function current() {
88
+        return $this->at( $this->position );
89
+    }
90
+
91
+    /**
92
+     * Move forward to next element.
93
+     */
94
+    public function next() {
95
+        $this->position ++;
96
+    }
97
+
98
+    /**
99
+     * Return the key of the current element.
100
+     *
101
+     * @return mixed
102
+     */
103
+    public function key() {
104
+        return $this->position;
105
+    }
106
+
107
+    /**
108
+     * Checks if current position is valid.
109
+     *
110
+     * @return bool
111
+     */
112
+    public function valid() {
113
+        return isset( $this->elements[ $this->position ] );
114
+    }
115
+
116
+    /**
117
+     * Rewind the Iterator to the first element.
118
+     */
119
+    public function rewind() {
120
+        $this->position = 0;
121
+    }
122
+
123
+    /**
124
+     * Count elements of an object.
125
+     *
126
+     * @return int
127
+     */
128
+    public function count() {
129
+        return count( $this->elements );
130
+    }
131
+
132
+    /**
133
+     * Parses the Collection config to set its properties.
134
+     *
135
+     * @param array $config
136
+     *
137
+     * @throws LogicException
138
+     */
139
+    protected function parse_config( array $config ) {
140
+        if ( isset( $config['model'] ) ) {
141
+            $model = $config['model'];
142
+
143
+            if ( ! is_subclass_of( $model, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
144
+                throw new LogicException;
145
+            }
146
+
147
+            $this->model = $model;
148
+        }
149
+    }
150
+
151
+    /**
152
+     * {@inheritDoc}
153
+     *
154
+     * @return array
155
+     */
156
+    public function serialize() {
157
+        return array_map(function( $element ) {
158
+            if ( $element instanceof Serializes ) {
159
+                return $element->serialize();
160
+            }
161
+
162
+            return $element;
163
+        }, $this->elements);
164
+    }
165 165
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	 * @param array $elements
42 42
 	 * @param array $config
43 43
 	 */
44
-	public function __construct( array $elements = array(), array $config = array() ) {
45
-		$this->parse_config( $config );
44
+	public function __construct(array $elements = array(), array $config = array()) {
45
+		$this->parse_config($config);
46 46
 
47
-		foreach ( $elements as $element ) {
48
-			$this->add( $element );
47
+		foreach ($elements as $element) {
48
+			$this->add($element);
49 49
 		}
50 50
 	}
51 51
 
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @throws RuntimeException
58 58
 	 */
59
-	public function add( $element ) {
60
-		if ( $this->model && is_array( $element ) ) {
61
-			$element = new $this->model( $element );
59
+	public function add($element) {
60
+		if ($this->model && is_array($element)) {
61
+			$element = new $this->model($element);
62 62
 		}
63 63
 
64
-		if ( $this->model && ! ( $element instanceof $this->model ) ) {
64
+		if ($this->model && !($element instanceof $this->model)) {
65 65
 			throw new RuntimeException;
66 66
 		}
67 67
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return mixed
77 77
 	 */
78
-	public function at( $index ) {
79
-		return $this->elements[ $index ];
78
+	public function at($index) {
79
+		return $this->elements[$index];
80 80
 	}
81 81
 
82 82
 	/**
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	 * @return mixed
86 86
 	 */
87 87
 	public function current() {
88
-		return $this->at( $this->position );
88
+		return $this->at($this->position);
89 89
 	}
90 90
 
91 91
 	/**
92 92
 	 * Move forward to next element.
93 93
 	 */
94 94
 	public function next() {
95
-		$this->position ++;
95
+		$this->position++;
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @return bool
111 111
 	 */
112 112
 	public function valid() {
113
-		return isset( $this->elements[ $this->position ] );
113
+		return isset($this->elements[$this->position]);
114 114
 	}
115 115
 
116 116
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return int
127 127
 	 */
128 128
 	public function count() {
129
-		return count( $this->elements );
129
+		return count($this->elements);
130 130
 	}
131 131
 
132 132
 	/**
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @throws LogicException
138 138
 	 */
139
-	protected function parse_config( array $config ) {
140
-		if ( isset( $config['model'] ) ) {
139
+	protected function parse_config(array $config) {
140
+		if (isset($config['model'])) {
141 141
 			$model = $config['model'];
142 142
 
143
-			if ( ! is_subclass_of( $model, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
143
+			if (!is_subclass_of($model, 'Intraxia\Jaxion\Axolotl\Model')) {
144 144
 				throw new LogicException;
145 145
 			}
146 146
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 * @return array
155 155
 	 */
156 156
 	public function serialize() {
157
-		return array_map(function( $element ) {
158
-			if ( $element instanceof Serializes ) {
157
+		return array_map(function($element) {
158
+			if ($element instanceof Serializes) {
159 159
 				return $element->serialize();
160 160
 			}
161 161
 
Please login to merge, or discard this patch.
src/Axolotl/ServiceProvider.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@
 block discarded – undo
12 12
  * @subpackage Axolotl
13 13
  */
14 14
 class ServiceProvider implements ServiceProviderContract {
15
-	/**
16
-	 * {@inheritdoc}
17
-	 *
18
-	 * @param Container $container
19
-	 */
20
-	public function register( Container $container ) {
21
-		$container->define(
22
-			array( 'database' => 'Intraxia\Jaxion\Contract\Axolotl\EntityManager' ),
23
-			function ( $app ) {
24
-				return new EntityManager( new WP_Query, $app->fetch( 'slug' ) );
25
-			}
26
-		);
27
-	}
15
+    /**
16
+     * {@inheritdoc}
17
+     *
18
+     * @param Container $container
19
+     */
20
+    public function register( Container $container ) {
21
+        $container->define(
22
+            array( 'database' => 'Intraxia\Jaxion\Contract\Axolotl\EntityManager' ),
23
+            function ( $app ) {
24
+                return new EntityManager( new WP_Query, $app->fetch( 'slug' ) );
25
+            }
26
+        );
27
+    }
28 28
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
 	 *
18 18
 	 * @param Container $container
19 19
 	 */
20
-	public function register( Container $container ) {
20
+	public function register(Container $container) {
21 21
 		$container->define(
22
-			array( 'database' => 'Intraxia\Jaxion\Contract\Axolotl\EntityManager' ),
23
-			function ( $app ) {
24
-				return new EntityManager( new WP_Query, $app->fetch( 'slug' ) );
22
+			array('database' => 'Intraxia\Jaxion\Contract\Axolotl\EntityManager'),
23
+			function($app) {
24
+				return new EntityManager(new WP_Query, $app->fetch('slug'));
25 25
 			}
26 26
 		);
27 27
 	}
Please login to merge, or discard this patch.
src/Utility/Str.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
  * @subpackage Utility
12 12
  */
13 13
 class Str {
14
-	/**
15
-	 * Determine if a given string starts with a given substring.
16
-	 *
17
-	 * @param  string       $haystack
18
-	 * @param  string|array $needles
19
-	 *
20
-	 * @return bool
21
-	 */
22
-	public static function starts_with( $haystack, $needles ) {
23
-		foreach ( (array) $needles as $needle ) {
24
-			if ( '' !== $needle && 0 === strpos( $haystack, $needle ) ) {
25
-				return true;
26
-			}
27
-		}
14
+    /**
15
+     * Determine if a given string starts with a given substring.
16
+     *
17
+     * @param  string       $haystack
18
+     * @param  string|array $needles
19
+     *
20
+     * @return bool
21
+     */
22
+    public static function starts_with( $haystack, $needles ) {
23
+        foreach ( (array) $needles as $needle ) {
24
+            if ( '' !== $needle && 0 === strpos( $haystack, $needle ) ) {
25
+                return true;
26
+            }
27
+        }
28 28
 
29
-		return false;
30
-	}
29
+        return false;
30
+    }
31 31
 
32
-	/**
33
-	 * Determine if a given string ends with a given substring.
34
-	 *
35
-	 * @param  string       $haystack
36
-	 * @param  string|array $needles
37
-	 *
38
-	 * @return bool
39
-	 */
40
-	public static function ends_with( $haystack, $needles ) {
41
-		foreach ( (array) $needles as $needle ) {
42
-			if ( substr( $haystack, - strlen( $needle ) ) === (string) $needle ) {
43
-				return true;
44
-			}
45
-		}
32
+    /**
33
+     * Determine if a given string ends with a given substring.
34
+     *
35
+     * @param  string       $haystack
36
+     * @param  string|array $needles
37
+     *
38
+     * @return bool
39
+     */
40
+    public static function ends_with( $haystack, $needles ) {
41
+        foreach ( (array) $needles as $needle ) {
42
+            if ( substr( $haystack, - strlen( $needle ) ) === (string) $needle ) {
43
+                return true;
44
+            }
45
+        }
46 46
 
47
-		return false;
48
-	}
47
+        return false;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return bool
21 21
 	 */
22
-	public static function starts_with( $haystack, $needles ) {
23
-		foreach ( (array) $needles as $needle ) {
24
-			if ( '' !== $needle && 0 === strpos( $haystack, $needle ) ) {
22
+	public static function starts_with($haystack, $needles) {
23
+		foreach ((array) $needles as $needle) {
24
+			if ('' !== $needle && 0 === strpos($haystack, $needle)) {
25 25
 				return true;
26 26
 			}
27 27
 		}
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return bool
39 39
 	 */
40
-	public static function ends_with( $haystack, $needles ) {
41
-		foreach ( (array) $needles as $needle ) {
42
-			if ( substr( $haystack, - strlen( $needle ) ) === (string) $needle ) {
40
+	public static function ends_with($haystack, $needles) {
41
+		foreach ((array) $needles as $needle) {
42
+			if (substr($haystack, - strlen($needle)) === (string) $needle) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.