Skip to content

Commit

Permalink
re-factoring and add doc block
Browse files Browse the repository at this point in the history
  • Loading branch information
hashemirafsan committed Sep 14, 2020
1 parent 736b69d commit 1fb7526
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Fireworks.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

declare(strict_types=1);

namespace Hashemi\Fireworks;

Expand All @@ -12,7 +13,7 @@
*/
trait Fireworks
{
protected static function boot()
protected static function boot(): void
{
parent::boot();

Expand Down Expand Up @@ -46,27 +47,27 @@ protected static function boot()

/**
* @param Model $model
* @param $event
* @param string $event
*/
private function callBeforeEvent(Model $model, $event) : void
private function callBeforeEvent(Model $model, string $event): void
{
$this->callColumnsEvent($model, ('onModel%s' . Str::studly($event)));
}

/**
* @param Model $model
* @param $event
* @param string $event
*/
private function callAfterEvent(Model $model, $event) : void
private function callAfterEvent(Model $model, string $event): void
{
$this->callColumnsEvent($model, ('onModel%s'.Str::studly($event)));
}

/**
* @param $model
* @param $methodConvention
* @param Model $model
* @param string $methodConvention
*/
private function callColumnsEvent(Model $model, string $methodConvention) : void
private function callColumnsEvent(Model $model, string $methodConvention): void
{
foreach ($model->getDirty() ?? [] as $column => $newValue) {
$method = sprintf($methodConvention, Str::studly($column));
Expand Down

0 comments on commit 1fb7526

Please sign in to comment.