Skip to content

Commit 7c72744

Browse files
committed
Reformat all the stuff
Thanks to PHPStorm PSR-2
1 parent a2f95b8 commit 7c72744

29 files changed

+1438
-708
lines changed

src/Console/ClearCommand.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@
33
use DebugBar\DebugBar;
44
use Illuminate\Console\Command;
55

6-
class ClearCommand extends Command {
6+
class ClearCommand extends Command
7+
{
78

89
protected $name = 'debugbar:clear';
910
protected $description = 'Clear the Debugbar Storage';
1011
protected $debugbar;
1112

12-
public function __construct(DebugBar $debugbar) {
13+
public function __construct(DebugBar $debugbar)
14+
{
1315
$this->debugbar = $debugbar;
1416

1517
parent::__construct();
1618
}
1719

18-
public function fire() {
20+
public function fire()
21+
{
1922

20-
if($storage = $this->debugbar->getStorage()){
23+
if ($storage = $this->debugbar->getStorage()) {
2124
$storage->clear();
2225
$this->info('Debugbar Storage cleared!');
23-
}else{
26+
} else {
2427
$this->error('No Debugbar Storage found..');
2528
}
2629

src/Console/PublishCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
* @author Barry vd. Heuvel <barryvdh@gmail.com>
1010
* @deprecated No longer needed because of the AssetController
1111
*/
12-
class PublishCommand extends Command {
12+
class PublishCommand extends Command
13+
{
1314

1415
/**
1516
* The console command name.
@@ -51,6 +52,8 @@ public function __construct($assetPublisher)
5152
*/
5253
public function fire()
5354
{
54-
$this->info('NOTICE: Since laravel-debugbar 1.7.x, publishing assets is no longer necessary. The assets in public/packages/barryvdh/laravel-debugbar and maximebf/php-debugbar can be safely removed.');
55+
$this->info(
56+
'NOTICE: Since laravel-debugbar 1.7.x, publishing assets is no longer necessary. The assets in public/packages/barryvdh/laravel-debugbar and maximebf/php-debugbar can be safely removed.'
57+
);
5558
}
5659
}

src/Controllers/AssetController.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
use Symfony\Component\HttpFoundation\Response;
44

5-
class AssetController extends BaseController {
5+
class AssetController extends BaseController
6+
{
67

78
/** @var int The TTL (1 year) */
89
protected $ttl = 31536000;
@@ -18,9 +19,11 @@ public function js()
1819

1920
$content = $renderer->dumpAssetsToString('js');
2021

21-
$response = new Response($content, 200, array(
22+
$response = new Response(
23+
$content, 200, array(
2224
'Content-Type' => 'text/javascript',
23-
));
25+
)
26+
);
2427
$response->setTtl($this->ttl);
2528

2629
return $response;
@@ -37,9 +40,11 @@ public function css()
3740

3841
$content = $renderer->dumpAssetsToString('css');
3942

40-
$response = new Response($content, 200, array(
43+
$response = new Response(
44+
$content, 200, array(
4145
'Content-Type' => 'text/css',
42-
));
46+
)
47+
);
4348
$response->setTtl($this->ttl);
4449

4550
return $response;

src/Controllers/BaseController.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,42 @@
22

33
use Illuminate\Foundation\Application;
44

5-
if(class_exists('Illuminate\Routing\Controller')){
6-
5+
if (class_exists('Illuminate\Routing\Controller')) {
6+
77
// Laravel 4.1+ Controller
8-
class BaseController extends \Illuminate\Routing\Controller {
9-
8+
class BaseController extends \Illuminate\Routing\Controller
9+
{
10+
1011
/**
1112
* The application instance.
1213
*
1314
* @var \Illuminate\Foundation\Application
1415
*/
1516
protected $app;
16-
17+
1718
public function __construct(Application $app)
1819
{
1920
$this->app = $app;
2021
}
2122
}
22-
23-
}else{
24-
23+
24+
} else {
25+
2526
// Laravel 4.0 Controller
26-
class BaseController extends \Illuminate\Routing\Controllers\Controller {
27-
27+
class BaseController extends \Illuminate\Routing\Controllers\Controller
28+
{
29+
2830
/**
2931
* The application instance.
3032
*
3133
* @var \Illuminate\Foundation\Application
3234
*/
3335
protected $app;
34-
36+
3537
public function __construct()
3638
{
3739
$this->app = app();
3840
}
3941
}
40-
42+
4143
}

src/Controllers/OpenHandlerController.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
use DebugBar\OpenHandler;
44
use Illuminate\Http\Response;
55

6-
class OpenHandlerController extends BaseController {
6+
class OpenHandlerController extends BaseController
7+
{
78

89
public function handle()
910
{
@@ -12,16 +13,18 @@ public function handle()
1213

1314
$debugbar = $this->app['debugbar'];
1415

15-
if(!$debugbar->isEnabled()){
16+
if (!$debugbar->isEnabled()) {
1617
$this->app->abort('500', 'Debugbar is not enabled');
1718
}
1819

1920
$openHandler = new OpenHandler($debugbar);
2021

2122
$data = $openHandler->handle(null, false, false);
2223

23-
return new Response($data, 200, array(
24+
return new Response(
25+
$data, 200, array(
2426
'Content-Type' => 'application/json'
25-
));
27+
)
28+
);
2629
}
2730
}

src/DataCollector/AuthCollector.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
class AuthCollector extends DataCollector implements Renderable
1515
{
1616

17-
/** @var \Illuminate\Auth\AuthManager */
17+
/** @var \Illuminate\Auth\AuthManager */
1818
protected $auth;
19-
/** @var bool */
19+
/** @var bool */
2020
protected $showName = false;
2121

2222
/**
@@ -33,17 +33,17 @@ public function __construct(AuthManager $auth)
3333
*/
3434
public function setShowName($showName)
3535
{
36-
$this->showName = (bool) $showName;
36+
$this->showName = (bool)$showName;
3737
}
3838

3939
/**
4040
* @{inheritDoc}
4141
*/
4242
public function collect()
4343
{
44-
try{
44+
try {
4545
$user = $this->auth->user();
46-
}catch(\Exception $e){
46+
} catch (\Exception $e) {
4747
$user = null;
4848
}
4949
return $this->getUserInformation($user);
@@ -68,13 +68,14 @@ protected function getUserInformation(UserInterface $user = null)
6868
// useful. Try username and email.
6969
$identifier = $user->getAuthIdentifier();
7070
if (is_numeric($identifier)) {
71-
try{
71+
try {
7272
if ($user->username) {
7373
$identifier = $user->username;
74-
}elseif ($user->email) {
74+
} elseif ($user->email) {
7575
$identifier = $user->email;
7676
}
77-
}catch(\Exception $e){}
77+
} catch (\Exception $e) {
78+
}
7879
}
7980

8081
return array(
@@ -104,7 +105,7 @@ public function getWidgets()
104105
'default' => '{}'
105106
)
106107
);
107-
if($this->showName){
108+
if ($this->showName) {
108109
$widgets['auth.name'] = array(
109110
'icon' => 'user',
110111
'tooltip' => 'Auth status',

src/DataCollector/FilesCollector.php

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use DebugBar\DataCollector\Renderable;
77
use Illuminate\Foundation\Application;
88

9-
class FilesCollector extends DataCollector implements Renderable
9+
class FilesCollector extends DataCollector implements Renderable
1010
{
1111

12-
/** @var \Illuminate\Foundation\Application */
12+
/** @var \Illuminate\Foundation\Application */
1313
protected $app;
1414
protected $basePath;
15+
1516
/**
1617
* @param \Illuminate\Foundation\Application $app
1718
*/
@@ -31,19 +32,25 @@ public function collect()
3132

3233
$included = array();
3334
$alreadyCompiled = array();
34-
foreach($files as $file){
35+
foreach ($files as $file) {
3536
// Skip the files from Debugbar, they are only loaded for Debugging and confuse the output.
3637
// Of course some files are stil always loaded (ServiceProvider, Facade etc)
37-
if(strpos($file, 'vendor/maximebf/debugbar/src') !== false || strpos($file, 'vendor/barryvdh/laravel-debugbar/src') !== false){
38+
if (strpos($file, 'vendor/maximebf/debugbar/src') !== false || strpos(
39+
$file,
40+
'vendor/barryvdh/laravel-debugbar/src'
41+
) !== false
42+
) {
3843
continue;
39-
}elseif(!in_array($file,$compiled)){
44+
} elseif (!in_array($file, $compiled)) {
4045
$included[] = array(
41-
'message' => "'".$this->stripBasePath($file)."',", // Use PHP syntax so we can copy-paste to compile config file.
46+
'message' => "'" . $this->stripBasePath($file) . "',",
47+
// Use PHP syntax so we can copy-paste to compile config file.
4248
'is_string' => true,
4349
);
44-
}else{
50+
} else {
4551
$alreadyCompiled[] = array(
46-
'message' => "* '".$this->stripBasePath($file)."',", // Mark with *, so know they are compiled anyways.
52+
'message' => "* '" . $this->stripBasePath($file) . "',",
53+
// Mark with *, so know they are compiled anyways.
4754
'is_string' => true,
4855
);
4956
}
@@ -53,22 +60,33 @@ public function collect()
5360
$messages = array_merge($included, $alreadyCompiled);
5461

5562
return array(
56-
'messages' => $messages,
57-
'count' => count($included),
58-
);
63+
'messages' => $messages,
64+
'count' => count($included),
65+
);
66+
}
67+
68+
/**
69+
* Get the files included on load.
70+
*
71+
* @return array
72+
*/
73+
protected function getIncludedFiles()
74+
{
75+
return get_included_files();
5976
}
6077

6178
/**
6279
* Get the files that are going to be compiled, so they aren't as important.
6380
*
6481
* @return array
6582
*/
66-
protected function getCompiledFiles() {
67-
if($this->app && class_exists('Illuminate\Foundation\Console\OptimizeCommand')){
83+
protected function getCompiledFiles()
84+
{
85+
if ($this->app && class_exists('Illuminate\Foundation\Console\OptimizeCommand')) {
6886
$reflector = new \ReflectionClass('Illuminate\Foundation\Console\OptimizeCommand');
6987
$path = dirname($reflector->getFileName()) . '/Optimize/config.php';
7088

71-
if(file_exists($path)){
89+
if (file_exists($path)) {
7290
$app = $this->app;
7391
$core = require $path;
7492
return array_merge($core, $app['config']['compile']);
@@ -77,31 +95,15 @@ protected function getCompiledFiles() {
7795
return array();
7896
}
7997

80-
/**
81-
* Get the files included on load.
82-
*
83-
* @return array
84-
*/
85-
protected function getIncludedFiles() {
86-
return get_included_files();
87-
}
88-
8998
/**
9099
* Remove the basePath from the paths, so they are relative to the base
91100
*
92101
* @param $path
93102
* @return string
94103
*/
95-
protected function stripBasePath($path) {
96-
return ltrim(str_replace($this->basePath, '', $path), '/');
97-
}
98-
99-
/**
100-
* {@inheritDoc}
101-
*/
102-
public function getName()
104+
protected function stripBasePath($path)
103105
{
104-
return 'files';
106+
return ltrim(str_replace($this->basePath, '', $path), '/');
105107
}
106108

107109
/**
@@ -123,4 +125,12 @@ public function getWidgets()
123125
)
124126
);
125127
}
128+
129+
/**
130+
* {@inheritDoc}
131+
*/
132+
public function getName()
133+
{
134+
return 'files';
135+
}
126136
}

0 commit comments

Comments
 (0)