diff --git a/.gitignore b/.gitignore index 2f1207d..bd6777c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /src/.DS_Store ./vendor/* -/.idea \ No newline at end of file +/.idea +/vendor/ diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php index 33d9025..c0a204d 100644 --- a/src/Controllers/BaseController.php +++ b/src/Controllers/BaseController.php @@ -14,29 +14,32 @@ use Illuminate\Routing\Controller; /** - * @author: Dyan Galih https://dyangalih.com + * @author: Dyan Galih + * Date: 18/04/20 + * Time: 18.55 * Class BaseController * @package WebAppId\DDD\Controllers */ class BaseController extends Controller { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; - + /** * @var Container */ - private $container; - + protected $container; + public function __construct(Container $container) { $this->container = $container; } - + /** * @return Container + * @deprecated */ protected function getContainer() { return $this->container; } -} \ No newline at end of file +} diff --git a/src/Requests/AbstractFormRequest.php b/src/Requests/AbstractFormRequest.php index cbd215d..d884a89 100644 --- a/src/Requests/AbstractFormRequest.php +++ b/src/Requests/AbstractFormRequest.php @@ -10,8 +10,11 @@ use Illuminate\Foundation\Http\FormRequest; /** - * @author: Dyan Galih https://dyangalih.com + * @author: Dyan Galih + * Date: 18/04/20 + * Time: 18.55 * Class AbstractFormRequest + * @package WebAppId\DDD\Requests */ abstract class AbstractFormRequest extends FormRequest implements FormRequestContract { @@ -22,12 +25,12 @@ public function authorize(): bool { return true; } - + /** * @return mixed */ abstract function rules(): array; - + /** * @return array */ @@ -35,7 +38,7 @@ public function messages(): array { return []; } - + /** * @return array */ @@ -43,4 +46,4 @@ public function attributes(): array { return []; } -} \ No newline at end of file +} diff --git a/src/Requests/FormRequestContract.php b/src/Requests/FormRequestContract.php index 7b174b4..d889fb0 100644 --- a/src/Requests/FormRequestContract.php +++ b/src/Requests/FormRequestContract.php @@ -8,16 +8,19 @@ namespace WebAppId\DDD\Requests; /** - * @author: Dyan Galih https://dyangalih.com + * @author: Dyan Galih + * Date: 18/04/20 + * Time: 18.55 * Interface FormRequestContract + * @package WebAppId\DDD\Requests */ interface FormRequestContract { public function authorize(): bool; - + public function rules(): array; - + public function messages(): array; - + public function attributes(): array; -} \ No newline at end of file +} diff --git a/src/Responses/AbstractResponse.php b/src/Responses/AbstractResponse.php index db94ad7..5b43eae 100644 --- a/src/Responses/AbstractResponse.php +++ b/src/Responses/AbstractResponse.php @@ -8,57 +8,65 @@ namespace WebAppId\DDD\Responses; /** - * @author: Dyan Galih https://dyangalih.com + * @author: Dyan Galih + * Date: 18/04/20 + * Time: 18.55 * Class AbstractResponse + * @package WebAppId\DDD\Responses */ abstract class AbstractResponse { /** * @var bool */ - private $status; + protected $status; /** * @var string */ - private $message; - + protected $message; + /** * @return bool + * @deprecated */ public function isStatus(): bool { return $this->status; } - + /** * @return bool + * @deprecated */ public function getStatus(): bool { return $this->status; } - + /** * @param bool $status + * @deprecated */ public function setStatus(bool $status): void { $this->status = $status; } - + /** * @return string + * @deprecated */ public function getMessage(): string { return $this->message; } - + /** * @param string $message + * @deprecated */ public function setMessage(string $message): void { $this->message = $message; } -} \ No newline at end of file +} diff --git a/src/Services/BaseService.php b/src/Services/BaseService.php index b7443ba..52a04c2 100644 --- a/src/Services/BaseService.php +++ b/src/Services/BaseService.php @@ -11,16 +11,19 @@ use Illuminate\Container\Container; /** - * @author: Dyan Galih https://dyangalih.com + * @author: Dyan Galih + * Date: 18/04/20 + * Time: 18.55 * Class BaseService + * @package WebAppId\DDD\Services */ class BaseService { /** * @var Container */ - private $container; - + protected $container; + /** * BaseService constructor. * @param Container $container @@ -29,7 +32,7 @@ public function __construct(Container $container) { $this->container = $container; } - + /** * @return Container */ @@ -37,4 +40,4 @@ protected function getContainer(): Container { return $this->container; } -} \ No newline at end of file +} diff --git a/src/Tools/PopoTools.php b/src/Tools/PopoTools.php index 75e6f83..b92bf55 100644 --- a/src/Tools/PopoTools.php +++ b/src/Tools/PopoTools.php @@ -12,12 +12,15 @@ use Illuminate\Database\Eloquent\Model; /** - * @author: Dyan Galih https://dyangalih.com + * @author: Dyan Galih + * Date: 18/04/20 + * Time: 18.56 * Class PopoTools + * @package WebAppId\DDD\Tools */ class PopoTools { - + /** * @param mixed $object * @return string|false @@ -26,7 +29,7 @@ public function serializeJson($object) { return json_encode($this->serialize($object)); } - + private function fixKey($key): string { if (stripos($key, "\0") === 0) { @@ -36,7 +39,7 @@ private function fixKey($key): string } return $newKey; } - + /** * @param $object * @return array @@ -44,9 +47,9 @@ private function fixKey($key): string public function serialize($object) { $objectAsArray = (array)$object; - + foreach ($objectAsArray as $key => $value) { - + $newKey = $this->fixKey($key); if ($newKey != $key) { $this->replaceKey($objectAsArray, $key, $newKey); @@ -71,10 +74,10 @@ public function serialize($object) } } } - + return $objectAsArray; } - + /** * @param $array * @param $curkey @@ -88,10 +91,10 @@ function replaceKey(&$array, $curkey, $newkey) unset($array[$curkey]); return true; } - + return false; } - + /** * @param string $oldKey * @return string