Skip to content

Commit

Permalink
add method Php\Lang::sanitize
Browse files Browse the repository at this point in the history
  • Loading branch information
kaluzki committed Nov 10, 2019
1 parent 7f8aa94 commit cfa3006
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Oxidio/Cli/Meta/Tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ private function column(Oxidio\Meta\Column $column): Generator
private static function constName(string $value, string $class, $replace = 'ox'): string
{
return Oxidio\Oxidio::constName($value, $class) ??
strtoupper(Oxidio\Oxidio::sanitize(Oxidio\Oxidio::after($value, $replace)));
strtoupper(Php\Lang::sanitize(Oxidio\Oxidio::after($value, $replace)));
}
}
3 changes: 2 additions & 1 deletion src/Oxidio/Meta/ReflectionConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Generator;
use Oxidio;
use Php;

/**
* @property-read ReflectionNamespace $namespace
Expand Down Expand Up @@ -44,7 +45,7 @@ protected function resolveNamespace(): ReflectionNamespace
*/
protected function resolveName(): string
{
return Oxidio\Oxidio::sanitize($this->properties['name'] ?? '');
return Php\Lang::sanitize($this->properties['name'] ?? '');
}

/**
Expand Down
5 changes: 0 additions & 5 deletions src/Oxidio/Oxidio.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public static function after(string $input, $replacePrefix): string
return $input;
}

public static function sanitize(string $input, string $suffix = '_'): string
{
return in_array(strtolower($input), Php\Composer\DIPackages::RESERVED, true) ? $input . $suffix : $input;
}

public static function constName(string $value, string $class): ?string
{
static $cache = [];
Expand Down

0 comments on commit cfa3006

Please sign in to comment.