original_string: public static function filter($value, bool $allowNull = false)
      {
          if (self::valueIsNullAndValid($allowNull, $value)) {
              return null;
          }
  
          if ($value instanceof \DateTimeZone) {
              return $value;
          }
  
          if (!is_string($value) || trim($value) == '') {
              throw new FilterException('$value not a non-empty string');
          }
  
          try {
              return new \DateTimeZone($value);
          } catch (\Exception $e) {
              throw new FilterException($e->getMessage(), $e->getCode(), $e);
          }
      }
code: public static function filter($value, bool $allowNull = false)
      {
          if (self::valueIsNullAndValid($allowNull, $value)) {
              return null;
          }
  
          if ($value instanceof \DateTimeZone) {
              return $value;
          }
  
          if (!is_string($value) || trim($value) == '') {
              throw new FilterException('$value not a non-empty string');
          }
  
          try {
              return new \DateTimeZone($value);
          } catch (\Exception $e) {
              throw new FilterException($e->getMessage(), $e->getCode(), $e);
          }
      }
code_tokens: public static function filter ( $ value , bool $ allowNull = false ) { if ( self :: valueIsNullAndValid ( $ allowNull , $ value ) ) { return null ; } if ( $ value instanceof \ DateTimeZone ) { return $ value ; } if ( ! is_string ( $ value ) || trim ( $ value ) == '' ) { throw new FilterException ( '$value not a non-empty string' ) ; } try { return new \ DateTimeZone ( $ value ) ; } catch ( \ Exception $ e ) { throw new FilterException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
docstring: Filters the given value into a \DateTimeZone object.
  
  @param mixed   $value     The value to be filtered.
  @param boolean $allowNull True to allow nulls through, and false (default) if nulls should not be allowed.
  
  @return \DateTimeZone|null
  
  @throws FilterException if the value did not pass validation.
docstring_tokens: Filters the given value into a \ DateTimeZone object .