Skip to content

Commit 15ba289

Browse files
committed
Fixed code style
1 parent a7ccb8b commit 15ba289

File tree

35 files changed

+421
-360
lines changed

35 files changed

+421
-360
lines changed

hmvc/public/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function request(array $location, $data = null)
7676
$dispatcher->setParams($location["params"]);
7777
} else {
7878
$dispatcher->setParams(
79-
(array) $location["params"]
79+
(array)$location["params"]
8080
);
8181
}
8282
}
+22-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
<?php
22

3-
return new \Phalcon\Config(array(
4-
'database' => array(
5-
'adapter' => 'Mysql',
6-
'host' => 'localhost',
7-
'username' => 'root',
8-
'password' => '',
9-
'name' => 'test',
10-
),
11-
'application' => array(
12-
'modelsDir' => __DIR__ . '/../models/',
13-
'baseUri' => '/micro-factory-default/',
14-
),
15-
'models' => array(
16-
'metadata' => array(
17-
'adapter' => 'Memory'
18-
)
19-
)
20-
));
3+
use Phalcon\Config;
4+
5+
return new Config(
6+
[
7+
'database' => [
8+
'adapter' => 'Mysql',
9+
'host' => 'localhost',
10+
'username' => 'root',
11+
'password' => '',
12+
'name' => 'test',
13+
],
14+
'application' => [
15+
'modelsDir' => __DIR__ . '/../models/',
16+
'baseUri' => '/micro-factory-default/',
17+
],
18+
'models' => [
19+
'metadata' => [
20+
'adapter' => 'Memory'
21+
]
22+
]
23+
]
24+
);

micro-factory-default/public/index.php

+13-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* Read the configuration
1414
*/
15-
$config = include __DIR__.'/../config/config.php';
15+
$config = include __DIR__ . '/../config/config.php';
1616

1717
$di = new FactoryDefault();
1818

@@ -22,31 +22,32 @@
2222
$di->set('url', function () use ($config) {
2323
$url = new \Phalcon\Mvc\Url();
2424
$url->setBaseUri($config->application->baseUri);
25+
2526
return $url;
2627
});
2728

2829
/**
2930
* Database connection is created based in the parameters defined in the configuration file
3031
*/
3132
$di->set('db', function () use ($config) {
32-
return new Database(array(
33-
"host" => $config->database->host,
34-
"username" => $config->database->username,
35-
"password" => $config->database->password,
36-
"dbname" => $config->database->name
37-
));
33+
return new Database(
34+
[
35+
"host" => $config->database->host,
36+
"username" => $config->database->username,
37+
"password" => $config->database->password,
38+
"dbname" => $config->database->name
39+
]
40+
);
3841
});
3942

4043
/**
4144
* Registering an autoloader
4245
*/
4346
$loader = new Loader();
4447

45-
$loader->registerDirs(
46-
array(
47-
$config->application->modelsDir
48-
)
49-
)->register();
48+
$loader
49+
->registerDirs([$config->application->modelsDir])
50+
->register();
5051

5152
/**
5253
* Starting the application
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<title>Phalcon PHP Framework</title>
5-
</head>
6-
<body>
7-
<h1>Congratulations!</h1>
3+
<head>
4+
<title>Phalcon PHP Framework</title>
5+
</head>
6+
<body>
7+
<h1>Congratulations!</h1>
88

9-
<p>You're now flying with Phalcon.</p>
9+
<p>You're now flying with Phalcon.</p>
1010

11-
<em>This page is located at views/index.phtml</em>
12-
</body>
11+
<em>This page is located at views/index.phtml</em>
12+
</body>
1313
</html>

micro-simple-views/config/services.php

+19-16
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,37 @@
1313
/**
1414
* The URL component is used to generate all kind of urls in the application
1515
*/
16-
$di->set('url', function () use ($config) {
16+
$di->setShared('url', function () use ($config) {
1717
$url = new UrlResolver();
1818
$url->setBaseUri($config->application->baseUri);
19+
1920
return $url;
20-
}, true);
21+
});
2122

2223
/**
2324
* Setting up the view component
2425
*/
25-
$di->set('view', function () use ($config) {
26-
26+
$di->setShared('view', function () use ($config) {
2727
$view = new View();
2828

2929
$view->setViewsDir($config->application->viewsDir);
3030

31-
$view->registerEngines(array(
32-
'.volt' => function ($view, $di) use ($config) {
33-
34-
$volt = new VoltEngine($view, $di);
31+
$view->registerEngines(
32+
[
33+
'.volt' => function ($view, $di) use ($config) {
34+
$volt = new VoltEngine($view, $di);
3535

36-
$volt->setOptions(array(
37-
'compiledPath' => $config->application->cacheDir,
38-
'compiledSeparator' => '_',
39-
));
36+
$volt->setOptions(
37+
[
38+
'compiledPath' => $config->application->cacheDir,
39+
'compiledSeparator' => '_',
40+
]
41+
);
4042

41-
return $volt;
42-
}
43-
));
43+
return $volt;
44+
}
45+
]
46+
);
4447

4548
return $view;
46-
}, true);
49+
});
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
<?php
22

3-
return new \Phalcon\Config(array(
4-
'database' => array(
5-
'adapter' => 'Mysql',
6-
'host' => 'localhost',
7-
'username' => 'root',
8-
'password' => '',
9-
'name' => 'test',
10-
),
11-
'application' => array(
12-
'controllersDir' => __DIR__ . '/../controllers/',
13-
'modelsDir' => __DIR__ . '/../models/',
14-
'viewsDir' => __DIR__ . '/../views/',
15-
)
16-
));
3+
use Phalcon\Config;
4+
5+
return new Config(
6+
[
7+
'database' => [
8+
'adapter' => 'Mysql',
9+
'host' => 'localhost',
10+
'username' => 'root',
11+
'password' => '',
12+
'name' => 'test',
13+
],
14+
'application' => [
15+
'controllersDir' => __DIR__ . '/../controllers/',
16+
'modelsDir' => __DIR__ . '/../models/',
17+
'viewsDir' => __DIR__ . '/../views/',
18+
]
19+
]
20+
);
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<title>Phalcon Framework</title>
5-
</head>
6-
<body>
7-
<?php echo $this->getContent(); ?>
8-
</body>
3+
<head>
4+
<title>Phalcon Framework</title>
5+
</head>
6+
<body>
7+
<?php echo $this->getContent(); ?>
8+
</body>
99
</html>

multiple-factory-default/public/index.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
$di->set('router', function () {
1616
$router = new \Phalcon\Mvc\Router();
1717
$router->setDefaultModule("frontend");
18+
1819
return $router;
1920
});
2021

@@ -24,6 +25,7 @@
2425
$di->set('url', function () {
2526
$url = new \Phalcon\Mvc\Url();
2627
$url->setBaseUri('/mvc/multiple-factory-default/');
28+
2729
return $url;
2830
});
2931

@@ -33,6 +35,7 @@
3335
$di->set('session', function () {
3436
$session = new \Phalcon\Session\Adapter\Files();
3537
$session->start();
38+
3639
return $session;
3740
});
3841

@@ -46,12 +49,14 @@
4649
/**
4750
* Register application modules
4851
*/
49-
$application->registerModules(array(
50-
'frontend' => array(
51-
'className' => 'Modules\Frontend\Module',
52-
'path' => '../apps/frontend/Module.php'
53-
)
54-
));
52+
$application->registerModules(
53+
[
54+
'frontend' => [
55+
'className' => 'Modules\Frontend\Module',
56+
'path' => '../apps/frontend/Module.php'
57+
]
58+
]
59+
);
5560

5661
echo $application->handle()->getContent();
5762
} catch (Phalcon\Exception $e) {
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?php
2-
return new \Phalcon\Config(array(
3-
'database' => array(
4-
'adapter' => 'Mysql',
5-
'host' => 'localhost',
6-
'username' => 'root',
7-
'password' => '',
8-
'dbname' => 'phalcon',
9-
),
10-
'application' => array(
11-
'controllersDir' => __DIR__ . '/../controllers/',
12-
'modelsDir' => __DIR__ . '/../models/',
13-
'viewsDir' => __DIR__ . '/../views/',
14-
'libraryDir' => __DIR__ . '/../library/',
15-
'pluginsDir' => __DIR__ . '/../plugin/',
16-
'baseUri' => '/'
17-
)
18-
));
2+
3+
use Phalcon\Config;
4+
5+
return new Config(
6+
[
7+
'database' => [
8+
'adapter' => 'Mysql',
9+
'host' => 'localhost',
10+
'username' => 'root',
11+
'password' => '',
12+
'dbname' => 'phalcon',
13+
],
14+
'application' => [
15+
'controllersDir' => __DIR__ . '/../controllers/',
16+
'modelsDir' => __DIR__ . '/../models/',
17+
'viewsDir' => __DIR__ . '/../views/',
18+
'libraryDir' => __DIR__ . '/../library/',
19+
'pluginsDir' => __DIR__ . '/../plugin/',
20+
'baseUri' => '/'
21+
]
22+
]
23+
);

multiple-service-layer-model/apps/config/modules.php

+12-10
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
* Register application modules
44
*/
55

6-
$application->registerModules(array(
7-
'frontend' => array(
8-
'className' => 'Modules\Modules\Frontend\Module',
9-
'path' => __DIR__ . '/../modules/frontend/Module.php'
10-
),
11-
'dashboard' => array(
12-
'className' => 'Modules\Modules\Dashboard\Module',
13-
'path' => __DIR__ . '/../modules/dashboard/Module.php'
14-
)
15-
));
6+
$application->registerModules(
7+
[
8+
'frontend' => [
9+
'className' => 'Modules\Modules\Frontend\Module',
10+
'path' => __DIR__ . '/../modules/frontend/Module.php'
11+
],
12+
'dashboard' => [
13+
'className' => 'Modules\Modules\Dashboard\Module',
14+
'path' => __DIR__ . '/../modules/dashboard/Module.php'
15+
]
16+
]
17+
);
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
<?php
22

3-
return new \Phalcon\Config(array(
4-
'database' => array(
5-
'adapter' => 'Mysql',
6-
'host' => 'localhost',
7-
'username' => 'root',
8-
'password' => '',
9-
'name' => 'test',
10-
),
11-
'application' => array(
12-
'controllersDir' => __DIR__ . '/../controllers/',
13-
'modelsDir' => __DIR__ . '/../models/',
14-
'viewsDir' => __DIR__ . '/../views/',
15-
)
16-
));
3+
use Phalcon\Config;
4+
5+
return new Config(
6+
[
7+
'database' => [
8+
'adapter' => 'Mysql',
9+
'host' => 'localhost',
10+
'username' => 'root',
11+
'password' => '',
12+
'name' => 'test',
13+
],
14+
'application' => [
15+
'controllersDir' => __DIR__ . '/../controllers/',
16+
'modelsDir' => __DIR__ . '/../models/',
17+
'viewsDir' => __DIR__ . '/../views/',
18+
]
19+
]
20+
);

0 commit comments

Comments
 (0)