-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite utility classes making use of collect()
Refactor directives using new utility classes as well as allowing additional arguments to be passed for ACF directives such as post ID Remove @getsub and @Getfield Other misc. clean up
- Loading branch information
Showing
4 changed files
with
145 additions
and
60 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
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
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 |
---|---|---|
@@ -1,17 +1,31 @@ | ||
<?php | ||
|
||
namespace App; | ||
namespace App\Directives; | ||
|
||
class Util | ||
{ | ||
/** | ||
* Removes the paranthesis passed through the Blade directive when multiple arguments are present. | ||
* Parse expression passed to directive. | ||
* | ||
* @param mixed $args | ||
* @param string $expression | ||
* @return \Illuminate\Support\Collection | ||
*/ | ||
public static function parse($expression) | ||
{ | ||
return collect(explode(',', $expression)) | ||
->map(function($item) { | ||
return trim($item); | ||
}); | ||
} | ||
|
||
/** | ||
* Strip single quotes from expression. | ||
* | ||
* @param string $expression | ||
* @return string | ||
*/ | ||
public static function Args($args) | ||
public static function strip($expression) | ||
{ | ||
return explode(', ', strtr($args, ['(' => '', ')' => ''])); | ||
return str_replace("'", '', $expression); | ||
} | ||
} |