Skip to content

Commit bb1cccf

Browse files
webwizoStyleCIBot
authored andcommitted
Applied fixes from StyleCI
1 parent cde0cf8 commit bb1cccf

9 files changed

+30
-36
lines changed

src/Compilers/Shortcode.php

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace Webwizo\Shortcodes\Compilers;
22

3-
class Shortcode {
3+
class Shortcode
4+
{
45

56
/**
67
* Shortcode name
@@ -42,12 +43,9 @@ public function get($attribute, $fallback = null)
4243
{
4344
$value = $this->{$attribute};
4445

45-
if(!is_null($value))
46-
{
46+
if (!is_null($value)) {
4747
return $attribute . '="' . $value . '"';
48-
}
49-
elseif(!is_null($fallback))
50-
{
48+
} elseif (!is_null($fallback)) {
5149
return $attribute . '="' . $fallback . '"';
5250
}
5351
}
@@ -88,5 +86,4 @@ public function __get($param)
8886
{
8987
return isset($this->attributes[$param]) ? $this->attributes[$param] : null;
9088
}
91-
92-
}
89+
}

src/Compilers/ShortcodeCompiler.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ public function add($name, $callback)
7272
public function compile($value)
7373
{
7474
// Only continue is laravel-shortcodes have been registered
75-
if (!$this->enabled || !$this->hasShortcodes())
75+
if (!$this->enabled || !$this->hasShortcodes()) {
7676
return $value;
77+
}
7778
// Set empty result
7879
$result = '';
7980
// Here we will loop through all of the tokens returned by the Zend lexer and

src/Facades/Shortcode.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
use Illuminate\Support\Facades\Facade;
44

5-
class Shortcode extends Facade {
5+
class Shortcode extends Facade
6+
{
67

78
/**
89
* Get the registered name of the component.
@@ -13,5 +14,4 @@ protected static function getFacadeAccessor()
1314
{
1415
return 'shortcode';
1516
}
16-
17-
}
17+
}

src/ShortcodesServiceProvider.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public function enableCompiler()
2525
$state = $this->app['config']->get('laravel-shortcodes::enabled', false);
2626

2727
// enable when needed
28-
if($state)
28+
if ($state) {
2929
$this->app['shortcode.compiler']->enable();
30+
}
3031
}
3132

3233
/**
@@ -46,8 +47,7 @@ public function register()
4647
*/
4748
public function registerShortcodeCompiler()
4849
{
49-
$this->app->singleton('shortcode.compiler', function($app)
50-
{
50+
$this->app->singleton('shortcode.compiler', function ($app) {
5151
return new ShortcodeCompiler();
5252
});
5353
}
@@ -57,7 +57,7 @@ public function registerShortcodeCompiler()
5757
*/
5858
public function registerShortcode()
5959
{
60-
$this->app->singleton('shortcode', function($app) {
60+
$this->app->singleton('shortcode', function ($app) {
6161
return new Shortcode($app['shortcode.compiler']);
6262
});
6363
}
@@ -67,8 +67,7 @@ public function registerShortcode()
6767
*/
6868
public function registerView()
6969
{
70-
$this->app->singleton('view', function($app)
71-
{
70+
$this->app->singleton('view', function ($app) {
7271
// Next we need to grab the engine resolver instance that will be used by the
7372
// environment. The resolver will be used by an environment to get each of
7473
// the various engine implementations such as plain PHP or Blade engine.
@@ -102,4 +101,4 @@ public function provides()
102101
'view'
103102
);
104103
}
105-
}
104+
}

src/View/Factory.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
use Illuminate\View\Factory as IlluminateViewFactory;
88
use Webwizo\Shortcodes\Compilers\ShortcodeCompiler;
99

10-
class Factory extends IlluminateViewFactory {
10+
class Factory extends IlluminateViewFactory
11+
{
1112

1213
/**
1314
* Short code engine resolver
@@ -40,7 +41,9 @@ public function __construct(EngineResolver $engines, ViewFinderInterface $finder
4041
*/
4142
public function make($view, $data = array(), $mergeData = array())
4243
{
43-
if (isset($this->aliases[$view])) $view = $this->aliases[$view];
44+
if (isset($this->aliases[$view])) {
45+
$view = $this->aliases[$view];
46+
}
4447

4548
$path = $this->finder->find($view);
4649

@@ -50,4 +53,4 @@ public function make($view, $data = array(), $mergeData = array())
5053

5154
return $view;
5255
}
53-
}
56+
}

src/View/View.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
use Illuminate\View\Engines\EngineInterface;
99
use Webwizo\Shortcodes\Compilers\ShortcodeCompiler;
1010

11-
class View extends IlluminateView implements ArrayAccess, Renderable {
11+
class View extends IlluminateView implements ArrayAccess, Renderable
12+
{
1213

1314
/**
1415
* Short code engine resolver
@@ -72,13 +73,10 @@ protected function renderContents()
7273

7374
$contents = $this->getContents();
7475

75-
if($this->shortcode->getStrip())
76-
{
76+
if ($this->shortcode->getStrip()) {
7777
// strip content without shortcodes
7878
$contents = $this->shortcode->strip($contents);
79-
}
80-
else
81-
{
79+
} else {
8280
// compile the shortcodes
8381
$contents = $this->shortcode->compile($contents);
8482
}
@@ -91,5 +89,4 @@ protected function renderContents()
9189

9290
return $contents;
9391
}
94-
9592
}

tests/ShortcodeRegistrationTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ public function testInstance()
2323

2424
public function testRegistrationAndCompileShortcode()
2525
{
26-
$this->shortcode->register('b', function($shortcode, $content) {
26+
$this->shortcode->register('b', function ($shortcode, $content) {
2727
return sprintf('<strong class="%s">%s</strong>', $shortcode->class, $content);
2828
});
2929

3030
$compiled = $this->shortcode->compile($this->string);
3131

3232
$this->assertEquals($this->compiled, $compiled);
3333
}
34-
35-
36-
}
34+
}

tests/ShortcodesServiceProviderTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ public function testShortcodeClass()
1515
$shortcode = app('shortcode');
1616
$this->assertInstanceOf('Webwizo\Shortcodes\Shortcode', $shortcode);
1717
}
18-
19-
}
18+
}

tests/TestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ protected function getPackageAliases($app)
1616
'Shortcode' => 'Webwizo\Shortcodes\Facades\Shortcode'
1717
];
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)