<?php
namespace Moto\Filter; use Moto; class NullValue extends AbstractFilter { protected $_verbose = false; public function setType($type = null) { if (Moto\System::isDevelopmentStage()) { Moto\System\Log::debug('Filter NullValue not support option type'); } return $this; } public function filter($value) { if (!isset($value)) { if ($this->_verbose) { echo "null because isset\n"; } return null; } if (empty($value)) { if ($this->_verbose) { echo "null because empty, type is " . gettype($value) . "\n"; } return null; } else { } if ($value === null) { if ($this->_verbose) { echo "null because null\n"; } return null; } if ($value === 0 || $value === 0.0) { if ($this->_verbose) { echo "null because $value\n"; } return null; } if ($value === '' || $value === '0') { if ($this->_verbose) { echo "null because '$value'\n"; } return null; } if ($value === []) { if ($this->_verbose) { echo "null because []\n"; } return null; } if ($value === false) { if ($this->_verbose) { echo "null because false\n"; } return null; } return $value; } } 