src/Forms/Transformers/StringToBooleanTransformer.php
public function transform($data)
    {
        if (is_null($data)) {
            return false;
        }

        if (! is_string($data)) {
            throw new DataTransformerException('A string value is expected.');
        }

        if (empty($data)) {
            return false;
        }

        if (in_array($data, ['off', 'no'], true)) {
            return false;
        }

        return true;
    }
public function transform($data)
    {
        if (is_null($data)) {
            return false;
        }

        if (! is_string($data)) {
            throw new DataTransformerException('A string value is expected.');
        }

        if (empty($data)) {
            return false;
        }

        if (in_array($data, ['off', 'no'], true)) {
            return false;
        }

        return true;
    }
public function transform ( $ data ) { if ( is_null ( $ data ) ) { return false ; } if ( ! is_string ( $ data ) ) { throw new DataTransformerException ( 'A string value is expected.' ) ; } if ( empty ( $ data ) ) { return false ; } if ( in_array ( $ data , [ 'off' , 'no' ] , true ) ) { return false ; } return true ; }
Convert a string to a boolean value.

@param string $data

@throws DataTransformerException

@return bool
Convert a string to a boolean value .