Passed
Push — master ( c606fb...d7b7f6 )
by nguereza
11:42
created
storage/migrations/20231207_053927_add_product_categories_table.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@
 block discarded – undo
14 14
         //Action when migrate up
15 15
         $this->create('product_categories', function (CreateTable $table) {
16 16
             $table->integer('id')
17
-                  ->autoincrement()
18
-                 ->primary();
17
+                    ->autoincrement()
18
+                    ->primary();
19 19
             
20 20
             $table->string('name')
21
-                 ->description('The category name')
22
-                 ->notNull();
21
+                    ->description('The category name')
22
+                    ->notNull();
23 23
             
24 24
             $table->string('description')
25
-                 ->description('The category description');
25
+                    ->description('The category description');
26 26
             
27 27
             $table->timestamps();
28 28
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     public function up(): void
13 13
     {
14 14
         //Action when migrate up
15
-        $this->create('product_categories', function (CreateTable $table) {
15
+        $this->create('product_categories', function(CreateTable $table) {
16 16
             $table->integer('id')
17 17
                   ->autoincrement()
18 18
                  ->primary();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use Platine\Database\Schema\CreateTable;
7 7
 use Platine\Framework\Migration\AbstractMigration;
8 8
 
9
-class AddProductCategoriesTable20231207053927 extends AbstractMigration
10
-{
9
+class AddProductCategoriesTable20231207053927 extends AbstractMigration {
11 10
 
12 11
     public function up(): void
13 12
     {
Please login to merge, or discard this patch.
app/Provider/ProductServiceProvider.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 class ProductServiceProvider extends ServiceProvider
17 17
 {
18 18
     /**
19
-    * {@inheritdoc}
20
-    */
19
+     * {@inheritdoc}
20
+     */
21 21
     public function register(): void
22 22
     {
23 23
         $this->app->bind(ProductCategoryRepository::class);
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
     /**
29
-    * {@inheritdoc}
30
-    */
29
+     * {@inheritdoc}
30
+     */
31 31
     public function addRoutes(Router $router): void
32 32
     {
33 33
         $router->group('/product', function (Router $router) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
 * @class ProductServiceProvider
14 14
 * @package Platine\App\Provider
15 15
 */
16
-class ProductServiceProvider extends ServiceProvider
17
-{
16
+class ProductServiceProvider extends ServiceProvider {
18 17
     /**
19 18
     * {@inheritdoc}
20 19
     */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     */
36 36
     public function addRoutes(Router $router): void
37 37
     {
38
-        $router->group('/product', function (Router $router) {
38
+        $router->group('/product', function(Router $router) {
39 39
             $router->resource('', ProductAction::class, 'product');
40 40
             $router->resource('/category', CategoryAction::class, 'product_category');
41 41
         });
Please login to merge, or discard this patch.
app/Model/Repository/ProductCategoryRepository.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
 class ProductCategoryRepository extends Repository
17 17
 {
18 18
     /**
19
-    * Create new instance
20
-    * @param EntityManager<ProductCategory> $manager
21
-    */
19
+     * Create new instance
20
+     * @param EntityManager<ProductCategory> $manager
21
+     */
22 22
     public function __construct(EntityManager $manager)
23 23
     {
24 24
         parent::__construct($manager, ProductCategory::class);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,14 +13,12 @@
 block discarded – undo
13 13
 * @package Platine\App\Model\Repository
14 14
 * @extends Repository<ProductCategory>
15 15
 */
16
-class ProductCategoryRepository extends Repository
17
-{
16
+class ProductCategoryRepository extends Repository {
18 17
     /**
19 18
     * Create new instance
20 19
     * @param EntityManager<ProductCategory> $manager
21 20
     */
22
-    public function __construct(EntityManager $manager)
23
-    {
21
+    public function __construct(EntityManager $manager) {
24 22
         parent::__construct($manager, ProductCategory::class);
25 23
     }
26 24
 }
Please login to merge, or discard this patch.
app/Model/Entity/ProductCategory.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@
 block discarded – undo
15 15
 class ProductCategory extends Entity
16 16
 {
17 17
     /**
18
-    * @param EntityMapperInterface<ProductCategory> $mapper
19
-    * @return void
20
-    */
18
+     * @param EntityMapperInterface<ProductCategory> $mapper
19
+     * @return void
20
+     */
21 21
     public static function mapEntity(EntityMapperInterface $mapper): void
22 22
     {
23 23
         $mapper->table('product_categories');
24 24
         $mapper->useTimestamp();
25 25
         $mapper->casts([
26
-           'created_at' => 'date',
27
-           'updated_at' => '?date',
26
+            'created_at' => 'date',
27
+            'updated_at' => '?date',
28 28
         ]);
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\App\Model\Entity
13 13
 * @extends Entity<ProductCategory>
14 14
 */
15
-class ProductCategory extends Entity
16
-{
15
+class ProductCategory extends Entity {
17 16
     /**
18 17
     * @param EntityMapperInterface<ProductCategory> $mapper
19 18
     * @return void
Please login to merge, or discard this patch.
app/Param/ProductCategoryParam.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@  discard block
 block discarded – undo
15 15
 class ProductCategoryParam extends BaseParam
16 16
 {
17 17
     /**
18
-    * The name field
19
-    * @var string
20
-    */
18
+     * The name field
19
+     * @var string
20
+     */
21 21
     protected string $name;
22 22
 
23 23
     /**
24
-    * The description field
25
-    * @var string|null
26
-    */
24
+     * The description field
25
+     * @var string|null
26
+     */
27 27
     protected ?string $description = null;
28 28
 
29 29
 
30 30
     /**
31
-    * @param TEntity $entity
32
-    * @return $this
33
-    */
31
+     * @param TEntity $entity
32
+     * @return $this
33
+     */
34 34
     public function fromEntity(Entity $entity): self
35 35
     {
36 36
         $this->name = $entity->name;
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     /**
43
-    * Return the name value
44
-    * @return string
45
-    */
43
+     * Return the name value
44
+     * @return string
45
+     */
46 46
     public function getName(): string
47 47
     {
48 48
         return $this->name;
49 49
     }
50 50
 
51
-   /**
52
-    * Return the description value
53
-    * @return string|null
54
-    */
51
+    /**
52
+     * Return the description value
53
+     * @return string|null
54
+     */
55 55
     public function getDescription(): ?string
56 56
     {
57 57
         return $this->description;
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 
60 60
 
61 61
     /**
62
-    * Set the name value
63
-    * @param string $name
64
-    * @return $this
65
-    */
62
+     * Set the name value
63
+     * @param string $name
64
+     * @return $this
65
+     */
66 66
     public function setName(string $name): self
67 67
     {
68 68
         $this->name = $name;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
         return $this;
71 71
     }
72 72
 
73
-   /**
74
-    * Set the description value
75
-    * @param string|null $description
76
-    * @return $this
77
-    */
73
+    /**
74
+     * Set the description value
75
+     * @param string|null $description
76
+     * @return $this
77
+     */
78 78
     public function setDescription(?string $description): self
79 79
     {
80 80
         $this->description = $description;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\App\Param
13 13
 * @template TEntity as Entity
14 14
 */
15
-class ProductCategoryParam extends BaseParam
16
-{
15
+class ProductCategoryParam extends BaseParam {
17 16
     /**
18 17
     * The name field
19 18
     * @var string
Please login to merge, or discard this patch.
app/Validator/ProductCategoryValidator.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 class ProductCategoryValidator extends AbstractValidator
20 20
 {
21 21
     /**
22
-    * The parameter instance
23
-    * @var ProductCategoryParam<TEntity>
24
-    */
22
+     * The parameter instance
23
+     * @var ProductCategoryParam<TEntity>
24
+     */
25 25
     protected ProductCategoryParam $param;
26 26
 
27 27
     /**
28
-    * Create new instance
29
-    * @param ProductCategoryParam<TEntity> $param
30
-    * @param Lang $lang
31
-    */
28
+     * Create new instance
29
+     * @param ProductCategoryParam<TEntity> $param
30
+     * @param Lang $lang
31
+     */
32 32
     public function __construct(ProductCategoryParam $param, Lang $lang)
33 33
     {
34 34
         parent::__construct($lang);
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     }
37 37
 
38 38
     /**
39
-    * {@inheritdoc}
40
-    */
39
+     * {@inheritdoc}
40
+     */
41 41
     public function setValidationData(): void
42 42
     {
43 43
         $this->addData('name', $this->param->getName());
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     /**
48
-    * {@inheritdoc}
49
-    */
48
+     * {@inheritdoc}
49
+     */
50 50
     public function setValidationRules(): void
51 51
     {
52 52
         $this->addRules('name', [
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 * @package Platine\App\Validator
17 17
 * @template TEntity as \Platine\Orm\Entity
18 18
 */
19
-class ProductCategoryValidator extends AbstractValidator
20
-{
19
+class ProductCategoryValidator extends AbstractValidator {
21 20
     /**
22 21
     * The parameter instance
23 22
     * @var ProductCategoryParam<TEntity>
@@ -29,8 +28,7 @@  discard block
 block discarded – undo
29 28
     * @param ProductCategoryParam<TEntity> $param
30 29
     * @param Lang $lang
31 30
     */
32
-    public function __construct(ProductCategoryParam $param, Lang $lang)
33
-    {
31
+    public function __construct(ProductCategoryParam $param, Lang $lang) {
34 32
         parent::__construct($lang);
35 33
         $this->param = $param;
36 34
     }
Please login to merge, or discard this patch.
storage/migrations/20231207_060117_add_products_table.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,35 +14,35 @@
 block discarded – undo
14 14
         //Action when migrate up
15 15
         $this->create('products', function (CreateTable $table) {
16 16
             $table->integer('id')
17
-                  ->autoincrement()
18
-                 ->primary();
17
+                    ->autoincrement()
18
+                    ->primary();
19 19
             
20 20
             $table->string('name')
21
-                 ->description('The product name')
22
-                 ->notNull();
21
+                    ->description('The product name')
22
+                    ->notNull();
23 23
             
24 24
             $table->string('description')
25
-                 ->description('The product description');
25
+                    ->description('The product description');
26 26
             
27 27
             $table->float('price')
28
-                   ->defaultValue(0)
29
-                   ->description('The product price')
30
-                   ->notNull();
28
+                    ->defaultValue(0)
29
+                    ->description('The product price')
30
+                    ->notNull();
31 31
             
32 32
             $table->float('quantity')
33
-                   ->defaultValue(0)
34
-                   ->description('The product quantity')
35
-                   ->notNull();
33
+                    ->defaultValue(0)
34
+                    ->description('The product quantity')
35
+                    ->notNull();
36 36
             
37 37
             $table->integer('product_category_id')
38
-                 ->description('Product category')
39
-                  ->notNull();
38
+                    ->description('Product category')
39
+                    ->notNull();
40 40
             
41 41
             $table->timestamps();
42 42
             
43 43
             $table->foreign('product_category_id')
44
-                  ->references('product_categories', 'id')
45
-                  ->onDelete('NO ACTION');
44
+                    ->references('product_categories', 'id')
45
+                    ->onDelete('NO ACTION');
46 46
 
47 47
             $table->engine('INNODB');
48 48
         });
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     public function up(): void
13 13
     {
14 14
         //Action when migrate up
15
-        $this->create('products', function (CreateTable $table) {
15
+        $this->create('products', function(CreateTable $table) {
16 16
             $table->integer('id')
17 17
                   ->autoincrement()
18 18
                  ->primary();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use Platine\Database\Schema\CreateTable;
7 7
 use Platine\Framework\Migration\AbstractMigration;
8 8
 
9
-class AddProductsTable20231207060117 extends AbstractMigration
10
-{
9
+class AddProductsTable20231207060117 extends AbstractMigration {
11 10
 
12 11
     public function up(): void
13 12
     {
Please login to merge, or discard this patch.
app/Model/Repository/ProductRepository.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
 class ProductRepository extends Repository
17 17
 {
18 18
     /**
19
-    * Create new instance
20
-    * @param EntityManager<Product> $manager
21
-    */
19
+     * Create new instance
20
+     * @param EntityManager<Product> $manager
21
+     */
22 22
     public function __construct(EntityManager $manager)
23 23
     {
24 24
         parent::__construct($manager, Product::class);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,14 +13,12 @@
 block discarded – undo
13 13
 * @package Platine\App\Model\Repository
14 14
 * @extends Repository<Product>
15 15
 */
16
-class ProductRepository extends Repository
17
-{
16
+class ProductRepository extends Repository {
18 17
     /**
19 18
     * Create new instance
20 19
     * @param EntityManager<Product> $manager
21 20
     */
22
-    public function __construct(EntityManager $manager)
23
-    {
21
+    public function __construct(EntityManager $manager) {
24 22
         parent::__construct($manager, Product::class);
25 23
     }
26 24
 }
Please login to merge, or discard this patch.
app/Model/Entity/Product.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
 class Product extends Entity
17 17
 {
18 18
     /**
19
-    * @param EntityMapperInterface<Product> $mapper
20
-    * @return void
21
-    */
19
+     * @param EntityMapperInterface<Product> $mapper
20
+     * @return void
21
+     */
22 22
     public static function mapEntity(EntityMapperInterface $mapper): void
23 23
     {
24
-         $mapper->useTimestamp();
25
-         $mapper->casts([
24
+            $mapper->useTimestamp();
25
+            $mapper->casts([
26 26
             'created_at' => 'date',
27 27
             'updated_at' => '?date',
28
-         ]);
28
+            ]);
29 29
 
30
-         $mapper->relation('category')->belongsTo(ProductCategory::class);
30
+            $mapper->relation('category')->belongsTo(ProductCategory::class);
31 31
 
32
-         $mapper->filter('category', function (Query $q, $value) {
33
-             $q->where('product_category_id')->is($value);
34
-         });
32
+            $mapper->filter('category', function (Query $q, $value) {
33
+                $q->where('product_category_id')->is($value);
34
+            });
35 35
     }
36 36
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
          $mapper->relation('category')->belongsTo(ProductCategory::class);
31 31
 
32
-         $mapper->filter('category', function (Query $q, $value) {
32
+         $mapper->filter('category', function(Query $q, $value) {
33 33
              $q->where('product_category_id')->is($value);
34 34
          });
35 35
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
 * @package Platine\App\Model\Entity
14 14
 * @extends Entity<Product>
15 15
 */
16
-class Product extends Entity
17
-{
16
+class Product extends Entity {
18 17
     /**
19 18
     * @param EntityMapperInterface<Product> $mapper
20 19
     * @return void
Please login to merge, or discard this patch.