Definition at line 33 of file Boolean.php.
◆ __construct()
__construct |
( |
|
$options = null | ) |
|
Constructor
- Parameters
-
Definition at line 87 of file Boolean.php.
95 $temp[
'type'] = array_shift(
$options);
99 $temp[
'casting'] = array_shift(
$options);
103 $temp[
'locale'] = array_shift(
$options);
109 if (array_key_exists(
'type',
$options)) {
113 if (array_key_exists(
'casting',
$options)) {
117 if (array_key_exists(
'locale',
$options)) {
elseif(isset( $params[ 'redirect_parent']))
setCasting($casting=true)
◆ _getLocalizedQuestion()
_getLocalizedQuestion |
( |
|
$value, |
|
|
|
$yes, |
|
|
|
$locale |
|
) |
| |
|
protected |
Determine the value of a localized string, and compare it to a given value
- Parameters
-
string | $value | |
boolean | $yes | |
array | $locale | |
- Returns
- boolean
Definition at line 356 of file Boolean.php.
366 $str = explode(
':', $str);
368 foreach($str as $no) {
369 if (($no ==
$value) || (strtolower($no) == strtolower(
$value))) {
static getTranslation($value=null, $path=null, $locale=null)
◆ filter()
Defined by Zend_Filter_Interface
Returns a boolean representation of $value
- Parameters
-
- Returns
- string
Implements Zend_Filter_Interface.
Definition at line 238 of file Boolean.php.
244 if (
$type >= self::YES) {
247 #require_once 'Zend/Locale.php'; 262 if (
$type >= self::FALSE_STRING) {
264 if (is_string(
$value) && (strtolower(
$value) ==
'false')) {
268 if ((!$casting) && is_string(
$value) && (strtolower(
$value) ==
'true')) {
274 if (
$type >= self::NULL) {
282 if (
$type >= self::EMPTY_ARRAY) {
290 if (
$type >= self::ZERO) {
296 if ((!$casting) && (is_string(
$value)) && (
$value ==
'1')) {
302 if (
$type >= self::STRING) {
310 if (
$type >= self::FLOAT) {
316 if ((!$casting) && is_float(
$value) && (
$value == 1.0)) {
322 if (
$type >= self::INTEGER) {
334 if (
$type >= self::BOOLEAN) {
_getLocalizedQuestion($value, $yes, $locale)
◆ getCasting()
Returns the casting option
- Returns
- boolean
Definition at line 210 of file Boolean.php.
◆ getLocale()
Returns the set locale
- Returns
- array
Definition at line 170 of file Boolean.php.
◆ getType()
Returns the set null types
- Returns
- int
Definition at line 127 of file Boolean.php.
◆ setCasting()
setCasting |
( |
|
$casting = true | ) |
|
Set the working mode
- Parameters
-
boolean | $locale | When true this filter works like cast When false it recognises only true and false and all other values are returned as is |
- Exceptions
-
- Returns
- Zend_Filter_Boolean
Definition at line 224 of file Boolean.php.
226 $this->_casting = (boolean) $casting;
◆ setLocale()
setLocale |
( |
|
$locale = null | ) |
|
Set the locales which are accepted
- Parameters
-
- Exceptions
-
- Returns
- Zend_Filter_Boolean
Definition at line 182 of file Boolean.php.
184 if (is_string($locale)) {
185 $locale = array($locale);
187 $locale = array($locale->toString());
188 }
elseif (!is_array($locale)) {
189 #require_once 'Zend/Filter/Exception.php'; 193 #require_once 'Zend/Locale.php'; 194 foreach ($locale as $single) {
196 #require_once 'Zend/Filter/Exception.php'; 201 $this->_locale = $locale;
elseif(isset( $params[ 'redirect_parent']))
static isLocale($locale, $strict=false, $compatible=true)
◆ setType()
Set the null types
- Parameters
-
- Exceptions
-
- Returns
- Zend_Filter_Boolean
Definition at line 139 of file Boolean.php.
141 if (is_array(
$type)) {
147 $detected += array_search(
$value, $this->_constants);
153 $type = array_search(
$type, $this->_constants);
157 #require_once 'Zend/Filter/Exception.php'; 161 $this->_type =
$type;
elseif(isset( $params[ 'redirect_parent']))
◆ $_casting
◆ $_constants
Initial value:= array(
self::BOOLEAN => 'boolean',
self::INTEGER => 'integer',
self::FLOAT => 'float',
self::STRING => 'string',
self::ZERO => 'zero',
self::EMPTY_ARRAY => 'array',
self::NULL => 'null',
self::PHP => 'php',
self::FALSE_STRING => 'false',
self::YES => 'yes',
self::ALL => 'all',
)
Definition at line 47 of file Boolean.php.
◆ $_locale
◆ $_type
◆ ALL
◆ BOOLEAN
◆ EMPTY_ARRAY
◆ FALSE_STRING
◆ FLOAT
◆ INTEGER
◆ NULL
◆ PHP
◆ STRING
◆ YES
◆ ZERO
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Filter/Boolean.php