-
Notifications
You must be signed in to change notification settings - Fork 39
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
Showing
11 changed files
with
460 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/** | ||
* micrometa | ||
* | ||
* @category Jkphl | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Infrastructure | ||
* @author Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @copyright Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
*/ | ||
|
||
/*********************************************************************************** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
***********************************************************************************/ | ||
|
||
namespace Jkphl\Micrometa\Infrastructure\Factory; | ||
|
||
use Jkphl\Micrometa\Ports\Rel\Alternate; | ||
|
||
/** | ||
* Alternate resource factory | ||
* | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Infrastructure | ||
*/ | ||
class AlternateFactory | ||
{ | ||
/** | ||
* Create alternate resource declaration from parser results | ||
* | ||
* @param array[] $rels Parser results | ||
* @return Alternate[] Alternate resource declarations | ||
*/ | ||
public static function createFromParserResult(array $alternates) | ||
{ | ||
return array_map([static::class, 'createAlternate'], $alternates); | ||
} | ||
|
||
/** | ||
* Create an alternate resource declaration | ||
* | ||
* @param array $alternate Alternate resource values | ||
* @return Alternate Alternate resource | ||
*/ | ||
protected function createRel($alternate) | ||
{ | ||
return new Alternate($alternate['value'], $alternate['type'], $alternate['title']); | ||
} | ||
} |
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 | ||
|
||
/** | ||
* micrometa | ||
* | ||
* @category Jkphl | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Infrastructure | ||
* @author Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @copyright Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
*/ | ||
|
||
/*********************************************************************************** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
***********************************************************************************/ | ||
|
||
namespace Jkphl\Micrometa\Infrastructure\Factory; | ||
|
||
use Jkphl\Micrometa\Application\Item\ItemInterface as ApplicationItemInterface; | ||
use Jkphl\Micrometa\Ports\Item\ItemInterface; | ||
|
||
/** | ||
* Item factory | ||
* | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Infrastructure | ||
*/ | ||
class ItemFactory | ||
{ | ||
/** | ||
* Create items from parser results | ||
* | ||
* @param ApplicationItemInterface[] $items Items | ||
* @return ItemInterface[] Items | ||
*/ | ||
public static function createFromParserResult(array $items) | ||
{ | ||
return array_map([static::class, 'createItem'], $items); | ||
} | ||
|
||
public static function createItem(ApplicationItemInterface $item) { | ||
|
||
} | ||
} |
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,81 @@ | ||
<?php | ||
|
||
/** | ||
* micrometa | ||
* | ||
* @category Jkphl | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Infrastructure | ||
* @author Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @copyright Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
*/ | ||
|
||
/*********************************************************************************** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
***********************************************************************************/ | ||
|
||
namespace Jkphl\Micrometa\Infrastructure\Factory; | ||
|
||
use Jkphl\Micrometa\Ports\Rel\Rel; | ||
|
||
/** | ||
* Rel declaration factory | ||
* | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Infrastructure | ||
*/ | ||
class RelFactory | ||
{ | ||
/** | ||
* Create rel declaration from parser results | ||
* | ||
* @param array[] $rels Parser results | ||
* @return array[] Rel declaration | ||
*/ | ||
public static function createFromParserResult(array $rels) | ||
{ | ||
return array_map([static::class, 'createRelType'], $rels); | ||
} | ||
|
||
/** | ||
* Create rel declarations of a particular type | ||
* | ||
* @param array $relType Rel type values | ||
* @return Rel[] Rel declarations | ||
*/ | ||
protected static function createRelType(array $relType) | ||
{ | ||
return array_map([static::class, 'createRel'], $relType); | ||
} | ||
|
||
/** | ||
* Create a rel declaration | ||
* | ||
* @param string $relValue Rel declaration value | ||
* @return Rel Rel declaration | ||
*/ | ||
protected function createRel($relValue) | ||
{ | ||
return new Rel($relValue); | ||
} | ||
} |
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,83 @@ | ||
<?php | ||
|
||
/** | ||
* micrometa | ||
* | ||
* @category Jkphl | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Ports | ||
* @author Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @copyright Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
*/ | ||
|
||
/*********************************************************************************** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright © 2017 Joschi Kuphal <joschi@kuphal.net> / @jkphl | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
***********************************************************************************/ | ||
|
||
namespace Jkphl\Micrometa\Ports\Exceptions; | ||
|
||
/** | ||
* Out of bounds exception | ||
* | ||
* @package Jkphl\Micrometa | ||
* @subpackage Jkphl\Micrometa\Ports | ||
*/ | ||
class OutOfBoundsException extends \OutOfBoundsException implements MicrometaExceptionInterface | ||
{ | ||
/** | ||
* Invalid rel tyle | ||
* | ||
* @var string | ||
*/ | ||
const INVALID_REL_TYPE_STR = 'Rel type "%s" is out of bounds'; | ||
/** | ||
* Invalid rel type | ||
* | ||
* @var int | ||
*/ | ||
const INVALID_REL_TYPE = 1489269267; | ||
/** | ||
* Invalid rel type index | ||
* | ||
* @var string | ||
*/ | ||
const INVALID_REL_INDEX_STR = 'Index "%s" for rel type "%s" is out of bounds'; | ||
/** | ||
* Invalid rel type index | ||
* | ||
* @var int | ||
*/ | ||
const INVALID_REL_INDEX = 1489268571; | ||
/** | ||
* Invalid alternate type | ||
* | ||
* @var string | ||
*/ | ||
const INVALID_ALTERNATE_TYPE_STR = 'Alternate type "%s" is out of bounds'; | ||
/** | ||
* Invalid alternate type | ||
* | ||
* @var int | ||
*/ | ||
const INVALID_ALTERNATE_TYPE = 1489268753; | ||
} |
Oops, something went wrong.