-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved elementsNotBlank function to ArrayUtil class
- Loading branch information
Showing
3 changed files
with
26 additions
and
21 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,24 @@ | ||
<?php | ||
|
||
namespace App\Util; | ||
|
||
class ArrayUtil | ||
{ | ||
/** | ||
* Checks if the array contains non-blank values specified by the given keys. | ||
* | ||
* @param array $array the array to be checked | ||
* @param array $keys the keys to be considered | ||
* @return bool if all values indicated by the specified keys are not blank | ||
*/ | ||
public static function elementsNotBlank(array $array, array $keys): bool | ||
{ | ||
foreach ($keys as $key) { | ||
if (!filled($array[$key])) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
} |
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