Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Illuminate\Validation\Rules; use BackedEnum; use Illuminate\Contracts\Su..
Decoded Output download
<?php
namespace Illuminate\Validation\Rules;
use BackedEnum;
use Illuminate\Contracts\Support\Arrayable;
use Stringable;
use UnitEnum;
class In implements Stringable
{
/**
* The name of the rule.
*
* @var string
*/
protected $rule = 'in';
/**
* The accepted values.
*
* @var array
*/
protected $values;
/**
* Create a new in rule instance.
*
* @param \Illuminate\Contracts\Support\Arrayable|\BackedEnum|\UnitEnum|array|string $values
* @return void
*/
public function __construct($values)
{
if ($values instanceof Arrayable) {
$values = $values->toArray();
}
$this->values = is_array($values) ? $values : func_get_args();
}
/**
* Convert the rule to a validation string.
*
* @return string
*
* @see \Illuminate\Validation\ValidationRuleParser::parseParameters
*/
public function __toString()
{
$values = array_map(function ($value) {
$value = match (true) {
$value instanceof BackedEnum => $value->value,
$value instanceof UnitEnum => $value->name,
default => $value,
};
return '"'.str_replace('"', '""', $value).'"';
}, $this->values);
return $this->rule.':'.implode(',', $values);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Illuminate\Validation\Rules;
use BackedEnum;
use Illuminate\Contracts\Support\Arrayable;
use Stringable;
use UnitEnum;
class In implements Stringable
{
/**
* The name of the rule.
*
* @var string
*/
protected $rule = 'in';
/**
* The accepted values.
*
* @var array
*/
protected $values;
/**
* Create a new in rule instance.
*
* @param \Illuminate\Contracts\Support\Arrayable|\BackedEnum|\UnitEnum|array|string $values
* @return void
*/
public function __construct($values)
{
if ($values instanceof Arrayable) {
$values = $values->toArray();
}
$this->values = is_array($values) ? $values : func_get_args();
}
/**
* Convert the rule to a validation string.
*
* @return string
*
* @see \Illuminate\Validation\ValidationRuleParser::parseParameters
*/
public function __toString()
{
$values = array_map(function ($value) {
$value = match (true) {
$value instanceof BackedEnum => $value->value,
$value instanceof UnitEnum => $value->name,
default => $value,
};
return '"'.str_replace('"', '""', $value).'"';
}, $this->values);
return $this->rule.':'.implode(',', $values);
}
}
Function Calls
| None |
Stats
| MD5 | 291d7212cb5c9b2ef3769a09fdeef45d |
| Eval Count | 0 |
| Decode Time | 85 ms |