Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aspect-Oriented Package to allow AOP approach to some problems using …
…annotations, for example logging, injection of request object, etc.
- Loading branch information
1 parent
0f4ec6b
commit 9dc5d60
Showing
17 changed files
with
1,126 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* @author Dimitar | ||
* @copyright 2015 Dimitar Dimitrov <daghostman.dimitrov@gmail.com> | ||
* @package codewave | ||
* @license MIT | ||
* | ||
* MIT LICENSE | ||
* | ||
* 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 Wave\Framework\Annotations\Controller; | ||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* Class Request | ||
* @package Wave\Framework\Annotations\Controller | ||
* | ||
* @Annotation | ||
* @Annotation\Target("METHOD") | ||
*/ | ||
class Request extends Annotation | ||
{} |
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,42 @@ | ||
<?php | ||
/** | ||
* @author Dimitar | ||
* @copyright 2015 Dimitar Dimitrov <daghostman.dimitrov@gmail.com> | ||
* @package codewave | ||
* @license MIT | ||
* | ||
* MIT LICENSE | ||
* | ||
* 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 Wave\Framework\Annotations\Controller; | ||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* Class Template | ||
* @package Wave\Framework\Annotations\Controller | ||
* | ||
* @Annotation | ||
* @Annotation\Target("METHOD") | ||
*/ | ||
class Template extends Annotation | ||
{ | ||
} |
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,90 @@ | ||
<?php | ||
/** | ||
* @author Dimitar | ||
* @copyright 2015 Dimitar Dimitrov <daghostman.dimitrov@gmail.com> | ||
* @package codewave | ||
* @license MIT | ||
* | ||
* MIT LICENSE | ||
* | ||
* 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 Wave\Framework\Annotations\General; | ||
|
||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* Class Catchable | ||
* @package Wave\Framework\Annotations\General | ||
* @Annotation | ||
* @Annotation\Target("METHOD") | ||
*/ | ||
class Catchable extends Annotation | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
public $map = []; | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getMap() | ||
{ | ||
return $this->map; | ||
} | ||
|
||
/** | ||
* @param $exception | ||
* @return string | ||
*/ | ||
public function getExceptionSeverity($exception) | ||
{ | ||
if (!array_key_exists($exception, $this->map)) { | ||
return 'emergency'; | ||
} | ||
|
||
return $this->map[$exception]['severity']; | ||
} | ||
|
||
/** | ||
* @param $exception | ||
* @return string | ||
*/ | ||
public function getExceptionMessage($exception) | ||
{ | ||
if (!array_key_exists($exception, $this->map)) { | ||
return <<<MESSAGE | ||
Call of {class}:{method} resulted in "{exception}" exception with message {message} @ {file}:{line} \n\r | ||
Arguments: {arguments} | ||
MESSAGE; | ||
} | ||
|
||
if (!array_key_exists('message', $this->map[$exception])) { | ||
return <<<MESSAGE | ||
Call of {class}:{method} resulted in "{exception}" exception with message {message} @ {file}:{line} \n\r | ||
Arguments: {arguments} | ||
MESSAGE; | ||
} | ||
|
||
return $this->map[$exception]['message']; | ||
} | ||
} |
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,54 @@ | ||
<?php | ||
/** | ||
* @author Dimitar | ||
* @copyright 2015 Dimitar Dimitrov <daghostman.dimitrov@gmail.com> | ||
* @package codewave | ||
* @license MIT | ||
* | ||
* MIT LICENSE | ||
* | ||
* 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 Wave\Framework\Annotations\Http; | ||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* Class Headers | ||
* @package Wave\Framework\Annotations\Http | ||
* | ||
* @Annotation | ||
* @Annotation\Target("METHOD") | ||
*/ | ||
class Headers extends Annotation | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $headers = []; | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getHeaders() | ||
{ | ||
return $this->headers; | ||
} | ||
} |
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,67 @@ | ||
<?php | ||
/** | ||
* @author Dimitar | ||
* @copyright 2015 Dimitar Dimitrov <daghostman.dimitrov@gmail.com> | ||
* @package codewave | ||
* @license MIT | ||
* | ||
* MIT LICENSE | ||
* | ||
* 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 Wave\Framework\Annotations\Http; | ||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* Class Response | ||
* @package Wave\Framework\Annotations\Http | ||
* | ||
* @Annotation | ||
* @Annotation\Target("METHOD") | ||
*/ | ||
class Response extends Annotation | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
protected $status = 200; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $headers = []; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getStatus() | ||
{ | ||
return $this->status; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getHeaders() | ||
{ | ||
return $this->headers; | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
/** | ||
* @author Dimitar | ||
* @copyright 2015 Dimitar Dimitrov <daghostman.dimitrov@gmail.com> | ||
* @package codewave | ||
* @license MIT | ||
* | ||
* MIT LICENSE | ||
* | ||
* 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 Wave\Framework\Annotations\Http; | ||
|
||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* Class Status | ||
* @package Wave\Framework\Annotations\Http | ||
* | ||
* @Annotation | ||
* @Annotation\Target("Method") | ||
*/ | ||
class Status extends Annotation | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public $status; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getStatus() | ||
{ | ||
return $this->status; | ||
} | ||
} |
Oops, something went wrong.