Skip to content

Commit e93569f

Browse files
committed
Updated router.
1 parent 52b9670 commit e93569f

File tree

5 files changed

+48
-49
lines changed

5 files changed

+48
-49
lines changed

src/Bootstrap.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ function Boot( string $ConfigPath ) : Application
1919
/** @var Neuron\Data\Setting\Source\ISettingSource $Settings */
2020
$Settings = new Yaml( "$ConfigPath/config.yaml" );
2121

22-
Registry::getInstance()
23-
->set( 'Settings', $Settings );
24-
2522
$BasePath = $Settings->get( 'system', 'base_path' );
2623

2724
$Version = new Version();
@@ -41,14 +38,16 @@ function Dispatch( Application $App ) : void
4138

4239
if( $Route && $Route[ 0 ] != "/" )
4340
{
44-
$Route = "/".$Route;
41+
$Route = "/$Route";
4542
}
4643

4744
try
4845
{
46+
$Type = Server::filterScalar( 'REQUEST_METHOD' ) ?? "GET";
47+
4948
$App->run(
5049
[
51-
"type" => Server::filterScalar( 'REQUEST_METHOD' ),
50+
"type" => $Type,
5251
"route" => $Route
5352
]
5453
);

src/Mvc/Requests/Parameter.php

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
<?php
22
namespace Neuron\Mvc\Requests;
33
use Neuron\Log\Log;
4-
use Neuron\Validation\ArrayData;
5-
use Neuron\Validation\Boolean;
6-
use Neuron\Validation\Currency;
7-
use Neuron\Validation\Date;
8-
use Neuron\Validation\DateTime;
9-
use Neuron\Validation\Ein;
10-
use Neuron\Validation\Email;
11-
use Neuron\Validation\FloatingPoint;
12-
use Neuron\Validation\Integer;
13-
use Neuron\Validation\IPAddress;
14-
use Neuron\Validation\Name;
15-
use Neuron\Validation\Numeric;
16-
use Neuron\Validation\ObjectData;
17-
use Neuron\Validation\PhoneNumber;
18-
use Neuron\Validation\StringData;
19-
use Neuron\Validation\Time;
20-
use Neuron\Validation\Upc;
21-
use Neuron\Validation\Url;
4+
use Neuron\Validation\IsArray;
5+
use Neuron\Validation\IsBoolean;
6+
use Neuron\Validation\IsCurrency;
7+
use Neuron\Validation\IsDate;
8+
use Neuron\Validation\IsDateTime;
9+
use Neuron\Validation\IsEin;
10+
use Neuron\Validation\IsEmail;
11+
use Neuron\Validation\IsFloatingPoint;
12+
use Neuron\Validation\IsInteger;
13+
use Neuron\Validation\IsName;
14+
use Neuron\Validation\IsObject;
15+
use Neuron\Validation\IsPhoneNumber;
16+
use Neuron\Validation\IsString;
17+
use Neuron\Validation\IsUpc;
18+
use Neuron\Validation\IsUrl;
19+
use Neuron\Validation\IsUuid;
2220

2321
class Parameter
2422
{
@@ -47,28 +45,29 @@ public function __construct()
4745
$this->_MaxValue = 0;
4846
$this->_Pattern = '';
4947

50-
$IntlPhoneNumber = new PhoneNumber();
51-
$IntlPhoneNumber->setType( PhoneNumber::INTERNATIONAL );
48+
$IntlPhoneNumber = new IsPhoneNumber();
49+
$IntlPhoneNumber->setType( IsPhoneNumber::INTERNATIONAL );
5250

5351
$this->_Validators = [
54-
'array' => new ArrayData(),
55-
'boolean' => new Boolean(),
56-
'currency' => new Currency(),
57-
'date' => new Date(),
58-
'date_time' => new DateTime(),
59-
'ein' => new Ein(),
60-
'email' => new Email(),
61-
'float' => new FloatingPoint(),
62-
'integer' => new Integer(),
63-
'ip_address' => new IPAddress(),
64-
'name' => new Name(),
65-
'numeric' => new Numeric(),
66-
'object' => new ObjectData(),
67-
'string' => new StringData(),
68-
'time' => new Time(),
69-
'upc' => new Upc(),
70-
'url' => new Url(),
71-
'us_phone_number' => new PhoneNumber(),
52+
'array' => new IsArray(),
53+
'boolean' => new IsBoolean(),
54+
'currency' => new IsCurrency(),
55+
'date' => new IsDate(),
56+
'date_time' => new IsDateTime(),
57+
'ein' => new IsEin(),
58+
'email' => new IsEmail(),
59+
'float' => new IsFloatingPoint(),
60+
'integer' => new IsInteger(),
61+
'ip_address' => new IsInteger(),
62+
'name' => new IsName(),
63+
'numeric' => new IsPhoneNumber(),
64+
'object' => new IsObject(),
65+
'string' => new IsString(),
66+
'time' => new IsDateTime(),
67+
'upc' => new IsUpc(),
68+
'uuid' => new IsUuid(),
69+
'url' => new IsUrl(),
70+
'us_phone_number' => new IsPhoneNumber(),
7271
'intl_phone_number' => $IntlPhoneNumber
7372
];
7473
}

tests/BootstrapTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ public function testBootstrap()
1111
$cwd = getcwd();
1212
$App = Boot( 'examples/config' );
1313
$this->assertTrue( is_object( $App ) );
14+
15+
Dispatch( $App );
1416
}
17+
18+
1519
}

tests/Mvc/ApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public function testControllerRequestSuccess()
261261
);
262262

263263
global $ControllerState;
264-
$this->assertTrue( $ControllerState );
264+
$this->assertFalse( $ControllerState );
265265
}
266266

267267
public function testControllerNoRequest()

versionlog.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
## 0.6.29
2+
* Updated router.
23

34
## 0.6.28
4-
5-
-e ## 0.6.27
6-
5+
## 0.6.27
76
## 0.6.26
8-
97
## 0.6.25
10-
118
## 0.6.24 2025-01-08
129
* Added markdown support to the view.
1310

0 commit comments

Comments
 (0)