-
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.
Merge pull request #5 from Shureban/v1.0.0
V1.0.0
- Loading branch information
Showing
39 changed files
with
746 additions
and
127 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 was deleted.
Oops, something went wrong.
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,48 @@ | ||
<?php | ||
|
||
use Carbon\Carbon; | ||
use Illuminate\Support\Carbon as CarbonSupport; | ||
use Illuminate\Support\Collection; | ||
use Shureban\LaravelObjectMapper\Types\BoxTypes\CarbonType; | ||
use Shureban\LaravelObjectMapper\Types\BoxTypes\CollectionType; | ||
use Shureban\LaravelObjectMapper\Types\BoxTypes\DateTimeType; | ||
use Shureban\LaravelObjectMapper\Types\Custom\CustomType; | ||
use Shureban\LaravelObjectMapper\Types\Custom\EnumType; | ||
use Shureban\LaravelObjectMapper\Types\Custom\ModelType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\ArrayType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\BoolType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\FloatType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\IntType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\MixedType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\ObjectType; | ||
use Shureban\LaravelObjectMapper\Types\SimpleTypes\StringType; | ||
|
||
return [ | ||
'types' => [ | ||
'simple' => [ | ||
'string' => StringType::class, | ||
'float' => FloatType::class, | ||
'double' => FloatType::class, | ||
'int' => IntType::class, | ||
'integer' => IntType::class, | ||
'bool' => BoolType::class, | ||
'boolean' => BoolType::class, | ||
'array' => ArrayType::class, | ||
'object' => ObjectType::class, | ||
'mixed' => MixedType::class, | ||
], | ||
'box' => [ | ||
DateTime::class => DateTimeType::class, | ||
CarbonSupport::class => CarbonType::class, | ||
Carbon::class => CarbonType::class, | ||
'Carbon' => CarbonType::class, | ||
Collection::class => CollectionType::class, | ||
'Collection' => CollectionType::class, | ||
], | ||
'other' => [ | ||
'custom' => CustomType::class, | ||
'enum' => EnumType::class, | ||
'model' => ModelType::class, | ||
], | ||
], | ||
]; |
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,9 @@ | ||
<?php | ||
|
||
namespace Shureban\LaravelObjectMapper\Exceptions; | ||
|
||
use Exception; | ||
|
||
abstract class ObjectMapperException extends Exception | ||
{ | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Shureban\LaravelObjectMapper\Exceptions; | ||
|
||
use Throwable; | ||
|
||
class ParseJsonException extends ObjectMapperException | ||
{ | ||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @param Throwable|null $previous | ||
*/ | ||
public function __construct(string $message, int $code = 0, ?Throwable $previous = null) | ||
{ | ||
parent::__construct($message, $code, $previous); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/Exceptions/WrongConstructorParametersNumberException.php
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,20 @@ | ||
<?php | ||
|
||
namespace Shureban\LaravelObjectMapper\Exceptions; | ||
|
||
use Throwable; | ||
|
||
class WrongConstructorParametersNumberException extends ObjectMapperException | ||
{ | ||
/** | ||
* @param string $class | ||
* @param int $code | ||
* @param Throwable|null $previous | ||
*/ | ||
public function __construct(string $class, int $code = 0, ?Throwable $previous = null) | ||
{ | ||
$message = sprintf('Wrong constructor parameters number: %s', $class); | ||
|
||
parent::__construct($message, $code, $previous); | ||
} | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace Shureban\LaravelObjectMapper; | ||
|
||
abstract class MappableObject | ||
{ | ||
use MappableTrait; | ||
} |
Oops, something went wrong.