-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ParameterBag is kept with static property.
- Loading branch information
1 parent
b79f4f0
commit 8e2abd9
Showing
5 changed files
with
311 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<?php | ||
/** | ||
* Input.php | ||
* Inputs.php | ||
* | ||
* This file is part of InitPHP. | ||
* This file is part of Input. | ||
* | ||
* @author Muhammet ŞAFAK <[email protected]> | ||
* @copyright Copyright © 2022 InitPHP | ||
* @license http://initphp.github.io/license.txt MIT | ||
* @version 1.0.2 | ||
* @copyright Copyright © 2022 Muhammet ŞAFAK | ||
* @license ./LICENSE MIT | ||
* @version 1.1 | ||
* @link https://www.muhammetsafak.com.tr | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace InitPHP\Input; | ||
namespace InitPHP\Input\Facede; | ||
|
||
/** | ||
* @mixin Stack | ||
* @mixin \InitPHP\Input\Inputs | ||
* @method static mixed get(string $key, mixed $default = null, ?array $validation = null) | ||
* @method static mixed getPost(string $key, mixed $default = null, ?array $validation = null) | ||
* @method static mixed getRaw(string $key, mixed $default = null, ?array $validation = null) | ||
|
@@ -36,39 +36,28 @@ | |
* @method static bool hasRaw(string $key) | ||
* @method static bool hasPost(string $key) | ||
*/ | ||
final class Input | ||
class Inputs | ||
{ | ||
|
||
protected static Stack $stack; | ||
/** @var \InitPHP\Input\Inputs */ | ||
private static $Inputs; | ||
|
||
public function __construct() | ||
private static function getInputInstance(): \InitPHP\Input\Inputs | ||
{ | ||
self::getStackInstance(); | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
if(isset(self::$stack)){ | ||
self::$stack->__destruct(); | ||
if(!isset(self::$Inputs)){ | ||
self::$Inputs = new \InitPHP\Input\Inputs(); | ||
} | ||
return self::$Inputs; | ||
} | ||
|
||
public function __call($name, $arguments) | ||
{ | ||
return self::getStackInstance()->{$name}(...$arguments); | ||
return self::getInputInstance()->{$name}(...$arguments); | ||
} | ||
|
||
public static function __callStatic($name, $arguments) | ||
{ | ||
return self::getStackInstance()->{$name}(...$arguments); | ||
} | ||
|
||
protected static function getStackInstance(): Stack | ||
{ | ||
if(!isset(self::$stack)){ | ||
self::$stack = new Stack(); | ||
} | ||
return self::$stack; | ||
return self::getInputInstance()->{$name}(...$arguments); | ||
} | ||
|
||
} |
Oops, something went wrong.