-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0dc917
commit e2dfa47
Showing
4 changed files
with
73 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ class MessageParser | |
* @var bool | ||
*/ | ||
protected $escape; | ||
|
||
/** | ||
* Create a new JsValidation instance. | ||
* | ||
|
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Proengsoft\JsValidation\Support; | ||
|
||
class FormRequestParser | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $className; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $params; | ||
|
||
/** | ||
* FormRequestParser constructor. | ||
* | ||
* @param string|array $request | ||
*/ | ||
public function __construct($request) | ||
{ | ||
$this->split($request); | ||
} | ||
|
||
/** | ||
* Form request class. | ||
* | ||
* @return string | ||
*/ | ||
public function className() | ||
{ | ||
return $this->className; | ||
} | ||
|
||
/** | ||
* Parameters to pass to the form request. | ||
* | ||
* @return array | ||
*/ | ||
public function params() | ||
{ | ||
return $this->params; | ||
} | ||
|
||
/** | ||
* Split the form request. | ||
* | ||
* @param $request | ||
* @return $this | ||
*/ | ||
protected function split($request) | ||
{ | ||
$params = []; | ||
if (is_array($request)) { | ||
$params = empty($request[1]) ? $params : $request[1]; | ||
$request = $request[0]; | ||
} | ||
|
||
$this->className = $request; | ||
$this->params = $params; | ||
|
||
return $this; | ||
} | ||
} |