Completed
Pull Request — master (#19)
by James
04:03
created
src/Core/Application.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -36,24 +36,24 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @throws ApplicationAlreadyBootedException
38 38
 	 */
39
-	public function __construct( $config, array $providers = array() ) {
40
-		if ( isset( static::$instances[ get_called_class() ] ) ) {
39
+	public function __construct($config, array $providers = array()) {
40
+		if (isset(static::$instances[get_called_class()])) {
41 41
 			throw new ApplicationAlreadyBootedException;
42 42
 		}
43 43
 
44
-		static::$instances[ get_called_class() ] = $this;
44
+		static::$instances[get_called_class()] = $this;
45 45
 
46
-		if ( ! ( $config instanceof Config ) ) {
47
-			$config = new Config( ConfigType::PLUGIN, $config );
46
+		if (!($config instanceof Config)) {
47
+			$config = new Config(ConfigType::PLUGIN, $config);
48 48
 		}
49 49
 
50
-		$this->register_constants( $config );
51
-		$this->register_core_services( $config );
50
+		$this->register_constants($config);
51
+		$this->register_core_services($config);
52 52
 
53
-		register_activation_hook( $config->file, array( $this, 'activate' ) );
54
-		register_deactivation_hook( $config->file, array( $this, 'deactivate' ) );
53
+		register_activation_hook($config->file, array($this, 'activate'));
54
+		register_deactivation_hook($config->file, array($this, 'deactivate'));
55 55
 
56
-		parent::__construct( $providers );
56
+		parent::__construct($providers);
57 57
 	}
58 58
 
59 59
 	/**
@@ -62,27 +62,27 @@  discard block
 block discarded – undo
62 62
 	 * @throws UnexpectedValueException
63 63
 	 */
64 64
 	public function boot() {
65
-		$loader = $this->fetch( 'loader' );
65
+		$loader = $this->fetch('loader');
66 66
 
67
-		if ( ! ( $loader instanceof LoaderContract ) ) {
67
+		if (!($loader instanceof LoaderContract)) {
68 68
 			throw new UnexpectedValueException;
69 69
 		}
70 70
 
71
-		foreach ( $this as $alias => $value ) {
72
-			if ( $value instanceof HasActions ) {
73
-				$loader->register_actions( $value );
71
+		foreach ($this as $alias => $value) {
72
+			if ($value instanceof HasActions) {
73
+				$loader->register_actions($value);
74 74
 			}
75 75
 
76
-			if ( $value instanceof HasFilters ) {
77
-				$loader->register_filters( $value );
76
+			if ($value instanceof HasFilters) {
77
+				$loader->register_filters($value);
78 78
 			}
79 79
 
80
-			if ( $value instanceof HasShortcode ) {
81
-				$loader->register_shortcode( $value );
80
+			if ($value instanceof HasShortcode) {
81
+				$loader->register_shortcode($value);
82 82
 			}
83 83
 		}
84 84
 
85
-		add_action( 'plugins_loaded', array( $loader, 'run' ) );
85
+		add_action('plugins_loaded', array($loader, 'run'));
86 86
 	}
87 87
 
88 88
 	/**
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 	 * @throws ApplicationNotBootedException
111 111
 	 */
112 112
 	public static function instance() {
113
-		if ( ! isset( static::$instances[ get_called_class() ] ) ) {
113
+		if (!isset(static::$instances[get_called_class()])) {
114 114
 			throw new ApplicationNotBootedException;
115 115
 		}
116 116
 
117
-		return static::$instances[ get_called_class() ];
117
+		return static::$instances[get_called_class()];
118 118
 	}
119 119
 
120 120
 	/**
121 121
 	 * {@inheritDoc}
122 122
 	 */
123 123
 	public static function shutdown() {
124
-		if ( isset( static::$instances[ get_called_class() ] ) ) {
125
-			unset( static::$instances[ get_called_class() ] );
124
+		if (isset(static::$instances[get_called_class()])) {
125
+			unset(static::$instances[get_called_class()]);
126 126
 		}
127 127
 	}
128 128
 
@@ -131,23 +131,23 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @param Config $config
133 133
 	 */
134
-	private function register_constants( Config $config ) {
135
-		$this->share( 'file', function() use ( $config ) {
134
+	private function register_constants(Config $config) {
135
+		$this->share('file', function() use ($config) {
136 136
 			return $config->file;
137 137
 		} );
138
-		$this->share( 'url', function() use ( $config ) {
138
+		$this->share('url', function() use ($config) {
139 139
 			return $config->url;
140 140
 		} );
141
-		$this->share( 'path', function() use ( $config ) {
141
+		$this->share('path', function() use ($config) {
142 142
 			return $config->path;
143 143
 		} );
144
-		$this->share( 'basename', function() use ( $config ) {
144
+		$this->share('basename', function() use ($config) {
145 145
 			return $config->basename;
146 146
 		} );
147
-		$this->share( 'slug', function() use ( $config ) {
147
+		$this->share('slug', function() use ($config) {
148 148
 			return $config->slug;
149 149
 		} );
150
-		$this->share( 'version', static::VERSION );
150
+		$this->share('version', static::VERSION);
151 151
 	}
152 152
 
153 153
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @param Config $config
157 157
 	 */
158
-	private function register_core_services( Config $config ) {
159
-		$this->share( array( 'config' => 'Intraxia\Jaxion\Core\Config' ), $config );
160
-		$this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function () {
158
+	private function register_core_services(Config $config) {
159
+		$this->share(array('config' => 'Intraxia\Jaxion\Core\Config'), $config);
160
+		$this->share(array('loader' => 'Intraxia\Jaxion\Contract\Core\Loader'), function() {
161 161
 			return new Loader;
162 162
 		} );
163
-		$this->share( array( 'i18n' => 'Intaxia\Jaxion\Contract\Core\I18n' ), function ( Container $app ) {
164
-			return new I18n( $app->fetch( 'basename' ), $app->fetch( 'path' ) );
163
+		$this->share(array('i18n' => 'Intaxia\Jaxion\Contract\Core\I18n'), function(Container $app) {
164
+			return new I18n($app->fetch('basename'), $app->fetch('path'));
165 165
 		} );
166 166
 	}
167 167
 }
Please login to merge, or discard this patch.
src/Core/Config.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 	 * @param string $type
58 58
 	 * @param string $file
59 59
 	 */
60
-	public function __construct( $type, $file ) {
61
-		$this->type = new ConfigType( $type );
60
+	public function __construct($type, $file) {
61
+		$this->type = new ConfigType($type);
62 62
 		$this->file = $file;
63 63
 
64
-		switch ( $this->type->getValue() ) {
64
+		switch ($this->type->getValue()) {
65 65
 			case ConfigType::PLUGIN:
66 66
 			case ConfigType::MU_PLUGIN:
67
-				$this->url = plugin_dir_url( $file );
68
-				$this->path = plugin_dir_path( $file );
69
-				$this->slug = dirname( $this->basename = plugin_basename( $file ) );
67
+				$this->url = plugin_dir_url($file);
68
+				$this->path = plugin_dir_path($file);
69
+				$this->slug = dirname($this->basename = plugin_basename($file));
70 70
 				break;
71 71
 			case ConfigType::THEME:
72
-				$this->url = get_stylesheet_directory_uri() . '/';
73
-				$this->path = get_stylesheet_directory() . '/';
74
-				$this->slug = dirname( $this->basename = plugin_basename( $file ) );
72
+				$this->url = get_stylesheet_directory_uri().'/';
73
+				$this->path = get_stylesheet_directory().'/';
74
+				$this->slug = dirname($this->basename = plugin_basename($file));
75 75
 				break;
76 76
 		}
77 77
 	}
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return array|null
85 85
 	 */
86
-	public function get_config_json( $filename ) {
87
-		if ( isset( $this->loaded[ $filename ] ) ) {
88
-			return $this->loaded[ $filename ];
86
+	public function get_config_json($filename) {
87
+		if (isset($this->loaded[$filename])) {
88
+			return $this->loaded[$filename];
89 89
 		}
90 90
 
91
-		$contents = file_get_contents( $this->path . 'config/' . $filename . '.json' );
91
+		$contents = file_get_contents($this->path.'config/'.$filename.'.json');
92 92
 
93
-		if ( false === $contents ) {
93
+		if (false === $contents) {
94 94
 			return null;
95 95
 		}
96 96
 
97
-		return $this->loaded[ $filename ] = json_decode( $contents, true );
97
+		return $this->loaded[$filename] = json_decode($contents, true);
98 98
 	}
99 99
 }
Please login to merge, or discard this patch.