Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/password-reset-merge' into feature/password-reset
- Loading branch information
Showing
72 changed files
with
2,882 additions
and
1,573 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
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,64 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: redjik | ||
* Date: 17.07.15 | ||
* Time: 20:12 | ||
*/ | ||
|
||
namespace App\Exceptions; | ||
|
||
use HttpException; | ||
use Spira\Responder\Contract\TransformableInterface; | ||
use Spira\Responder\Contract\TransformerInterface; | ||
|
||
class ValidationExceptionCollection extends HttpException implements TransformableInterface | ||
{ | ||
/** | ||
* @var ValidationException[] | ||
*/ | ||
private $exceptions; | ||
|
||
public function __construct(array $exceptions) | ||
{ | ||
$this->exceptions = $exceptions; | ||
} | ||
|
||
/** | ||
* Returns the status code. | ||
* | ||
* @return int An HTTP response status code | ||
*/ | ||
public function getStatusCode() | ||
{ | ||
return 422; | ||
} | ||
|
||
/** | ||
* Return the response instance. | ||
* | ||
* @return array | ||
*/ | ||
public function getResponse() | ||
{ | ||
$responses = []; | ||
foreach ($this->exceptions as $exception) { | ||
if (!is_null($exception)) { | ||
$responses[] = $exception->getResponse(); | ||
} else { | ||
$responses[] = null; | ||
} | ||
} | ||
|
||
return $responses; | ||
} | ||
|
||
/** | ||
* @param TransformerInterface $transformer | ||
* @return mixed | ||
*/ | ||
public function transform(TransformerInterface $transformer) | ||
{ | ||
return $transformer->transformCollection($this->getResponse()); | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: redjik | ||
* Date: 17.07.15 | ||
* Time: 18:19 | ||
*/ | ||
|
||
namespace App\Helpers; | ||
|
||
use Spira\Repository\Model\BaseModel; | ||
|
||
class RouteHelper | ||
{ | ||
public static $badRoutes = []; | ||
|
||
/** | ||
* @param BaseModel $model | ||
* @return string|false | ||
*/ | ||
public static function getRoute(BaseModel $model) | ||
{ | ||
if (!isset(static::$badRoutes[get_class($model)])) { | ||
try { | ||
return route(get_class($model), ['id'=>$model->getQueueableId()]); | ||
} catch (\InvalidArgumentException $e) { | ||
static::$badRoutes[get_class($model)] = true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
Oops, something went wrong.