From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- .../form/Symfony/Component/Form/Util/FormUtil.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php (limited to 'vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php') diff --git a/vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php b/vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php new file mode 100644 index 00000000..7647691e --- /dev/null +++ b/vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +/** + * @author Bernhard Schussek + */ +class FormUtil +{ + /** + * This class should not be instantiated + */ + private function __construct() {} + + /** + * Returns whether the given data is empty. + * + * This logic is reused multiple times throughout the processing of + * a form and needs to be consistent. PHP's keyword `empty` cannot + * be used as it also considers 0 and "0" to be empty. + * + * @param mixed $data + * + * @return Boolean + */ + public static function isEmpty($data) + { + // Should not do a check for array() === $data!!! + // This method is used in occurrences where arrays are + // not considered to be empty, ever. + return null === $data || '' === $data; + } +} -- cgit v1.2.3