Skip to content

Commit a1bb0a7

Browse files
committed
bump
1 parent 4be1c46 commit a1bb0a7

24 files changed

+964
-965
lines changed

examples/views/layouts/default.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<html>
22
<head></head>
3-
<title><?= $Title ?? '' ?></title>
3+
<title><?= $title ?? '' ?></title>
44
<body>
55
<h1>Test Layout</h1>
6-
<?= $Content ?>
6+
<?= $content ?>
77
</body>
88
</html>

src/Bootstrap.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,125 +11,125 @@
1111
/**
1212
* Initialize the application.
1313
*
14-
* @param string $ConfigPath
14+
* @param string $configPath
1515
* @return Application
1616
* @throws \Exception
1717
*/
1818

19-
function boot( string $ConfigPath ) : Application
19+
function boot( string $configPath ) : Application
2020
{
21-
/** @var Neuron\Data\Setting\Source\ISettingSource $Settings */
21+
/** @var Neuron\Data\Setting\Source\ISettingSource $settings */
2222

2323
try
2424
{
25-
$Settings = new Yaml( "$ConfigPath/config.yaml" );
26-
$BasePath = $Settings->get( 'system', 'base_path' );
25+
$settings = new Yaml( "$configPath/config.yaml" );
26+
$basePath = $settings->get( 'system', 'base_path' );
2727
}
2828
catch( \Exception $e )
2929
{
30-
$Settings = null;
31-
$BasePath = getenv( 'SYSTEM_BASE_PATH' ) ? : '.';
30+
$settings = null;
31+
$basePath = getenv( 'SYSTEM_BASE_PATH' ) ? : '.';
3232
}
3333

34-
$Version = new Version();
35-
$Version->loadFromFile( "$BasePath/.version.json" );
34+
$version = new Version();
35+
$version->loadFromFile( "$basePath/.version.json" );
3636

3737
try
3838
{
39-
$App = new Application( $Version->getAsString(), $Settings );
39+
$app = new Application( $version->getAsString(), $settings );
4040
}
4141
catch( \Throwable $e )
4242
{
4343
echo Application::beautifyException( $e );
4444
exit( 1 );
4545
}
4646

47-
return $App;
47+
return $app;
4848
}
4949

5050
/**
5151
* Dispatches the current route mapped in the 'route' GET variable.
5252
*
53-
* @param Application $App
53+
* @param Application $app
5454
*/
5555

56-
function dispatch( Application $App ) : void
56+
function dispatch( Application $app ) : void
5757
{
58-
$Route = Get::filterScalar( 'route' ) ?? "";
58+
$route = Get::filterScalar( 'route' ) ?? "";
5959

6060
try
6161
{
62-
$Type = Server::filterScalar( 'REQUEST_METHOD' ) ?? "GET";
62+
$type = Server::filterScalar( 'REQUEST_METHOD' ) ?? "GET";
6363

6464
// Support HTML form method spoofing via _method field
6565
// HTML forms can only submit GET/POST, so frameworks use a hidden _method field
6666
// to indicate PUT/DELETE/PATCH requests
67-
if( $Type === 'POST' && isset( $_POST['_method'] ) )
67+
if( $type === 'POST' && isset( $_POST['_method'] ) )
6868
{
69-
$SpoofedMethod = strtoupper( $_POST['_method'] );
70-
if( in_array( $SpoofedMethod, [ 'PUT', 'DELETE', 'PATCH' ] ) )
69+
$spoofedMethod = strtoupper( $_POST['_method'] );
70+
if( in_array( $spoofedMethod, [ 'PUT', 'DELETE', 'PATCH' ] ) )
7171
{
72-
$Type = $SpoofedMethod;
72+
$type = $spoofedMethod;
7373
}
7474
}
7575

76-
$App->run(
76+
$app->run(
7777
[
78-
"type" => $Type,
79-
"route" => $Route
78+
"type" => $type,
79+
"route" => $route
8080
]
8181
);
8282
}
8383
catch( \Throwable $e )
8484
{
85-
echo $App->handleException( $e );
85+
echo $app->handleException( $e );
8686
}
8787
}
8888

8989
/**
9090
* Clear expired cache entries
9191
*
92-
* @param Application $App
92+
* @param Application $app
9393
* @return int Number of entries removed
9494
*/
95-
function clearExpiredCache( Application $App ) : int
95+
function clearExpiredCache( Application $app ) : int
9696
{
97-
return $App->clearExpiredCache();
97+
return $app->clearExpiredCache();
9898
}
9999

100100
/**
101101
* Render a partial view from the shared directory.
102102
* This function looks for a file named _{name}.php in the shared views directory.
103103
* @param string $name The name of the partial (without underscore prefix or .php extension)
104-
* @param array $Data Optional data array to pass to the partial as variables
104+
* @param array $data Optional data array to pass to the partial as variables
105105
* @return void
106106
* @throws NotFound
107107
*/
108-
function partial( string $name, array $Data = [] ) : void
108+
function partial( string $name, array $data = [] ) : void
109109
{
110-
$Path = Registry::getInstance()
110+
$path = Registry::getInstance()
111111
->get( "Views.Path" );
112112

113-
if( !$Path )
113+
if( !$path )
114114
{
115-
$BasePath = Registry::getInstance()->get( "Base.Path" );
116-
$Path = "$BasePath/resources/views";
115+
$basePath = Registry::getInstance()->get( "Base.Path" );
116+
$path = "$basePath/resources/views";
117117
}
118118

119-
$View = "$Path/shared/_$name.php";
119+
$view = "$path/shared/_$name.php";
120120

121-
if( !file_exists( $View ) )
121+
if( !file_exists( $view ) )
122122
{
123-
throw new NotFound( "Partial not found: $View" );
123+
throw new NotFound( "Partial not found: $view" );
124124
}
125125

126126
// Extract data array as variables in the partial's scope
127-
extract( $Data );
127+
extract( $data );
128128

129129
ob_start();
130-
require( $View );
131-
$Content = ob_get_contents();
130+
require( $view );
131+
$content = ob_get_contents();
132132
ob_end_clean();
133133

134-
echo $Content;
134+
echo $content;
135135
}

0 commit comments

Comments
 (0)