-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: removes ability to write attributes and casts arrays in case other than camelcase INT-613
- Loading branch information
1 parent
1c9a68c
commit a79da45
Showing
36 changed files
with
195 additions
and
139 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MyParcelNL\Pdk\Base\Support; | ||
|
||
use MyParcelNL\Pdk\Base\Contract\Arrayable; | ||
use MyParcelNL\Sdk\src\Support\Str as SdkStr; | ||
|
||
class Str extends SdkStr | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private static $flagCaseCache = []; | ||
|
||
/** | ||
* @param string $string | ||
* @param null|int $flags | ||
* | ||
* @return string | ||
*/ | ||
public static function changeCase(string $string, ?int $flags = null): string | ||
{ | ||
$case = self::getFlagCase($flags); | ||
|
||
return self::{$case}($string); | ||
} | ||
|
||
/** | ||
* @param null|int $flags | ||
* | ||
* @return string | ||
*/ | ||
private static function getFlagCase(?int $flags = null): string | ||
{ | ||
if (! isset(self::$flagCaseCache[$flags])) { | ||
$case = 'camel'; | ||
|
||
if ($flags & Arrayable::CASE_SNAKE) { | ||
$case = 'snake'; | ||
} | ||
|
||
if ($flags & Arrayable::CASE_KEBAB) { | ||
$case = 'kebab'; | ||
} | ||
|
||
if ($flags & Arrayable::CASE_STUDLY) { | ||
$case = 'studly'; | ||
} | ||
|
||
self::$flagCaseCache[$flags] = $case; | ||
} | ||
|
||
return self::$flagCaseCache[$flags]; | ||
} | ||
} |
Oops, something went wrong.