public static function TryParse( $value, &$size, bool $fixed = false ) : bool
   {

      $size = null;

      if ( \is_int( $value ) )
      {
         // An single integer value will result in an quadratic size
         $size = new Size( $value, $value, $fixed );
         return true;
      }

      if ( \is_double( $value ) )
      {
         // Double|Float in converted to integer
         $size = new Size( (int) $value, (int) $value, $fixed );
         return true;
      }

      if ( \is_array( $value ) )
      {
         // Array get parsed by FromArray
         return ( false !== ( $size = self::FromArray( $value, $fixed ) ) );
      }

      if ( \is_string( $value ) )
      {
         // String get parsed by FromString
         return ( false !== ( $size = self::FromString( $value, $fixed ) ) );
      }

      if ( \is_resource( $value ) && \get_resource_type( $value ) === 'gd' )
      {
         try
         {
            $size = new Size( \imagesx( $value ), \imagesy( $value ), $fixed );
            return true;
         }
         catch ( \Throwable $ex )
         {
            $ex = null;
            return false;
         }
      }

      return false;

   }
public static function TryParse( $value, &$size, bool $fixed = false ) : bool
   {

      $size = null;

      if ( \is_int( $value ) )
      {
         // An single integer value will result in an quadratic size
         $size = new Size( $value, $value, $fixed );
         return true;
      }

      if ( \is_double( $value ) )
      {
         // Double|Float in converted to integer
         $size = new Size( (int) $value, (int) $value, $fixed );
         return true;
      }

      if ( \is_array( $value ) )
      {
         // Array get parsed by FromArray
         return ( false !== ( $size = self::FromArray( $value, $fixed ) ) );
      }

      if ( \is_string( $value ) )
      {
         // String get parsed by FromString
         return ( false !== ( $size = self::FromString( $value, $fixed ) ) );
      }

      if ( \is_resource( $value ) && \get_resource_type( $value ) === 'gd' )
      {
         try
         {
            $size = new Size( \imagesx( $value ), \imagesy( $value ), $fixed );
            return true;
         }
         catch ( \Throwable $ex )
         {
            $ex = null;
            return false;
         }
      }

      return false;

   }
public static function TryParse ( $ value , & $ size , bool $ fixed = false ) : bool { $ size = null ; if ( \ is_int ( $ value ) ) { // An single integer value will result in an quadratic size $ size = new Size ( $ value , $ value , $ fixed ) ; return true ; } if ( \ is_double ( $ value ) ) { // Double|Float in converted to integer $ size = new Size ( ( int ) $ value , ( int ) $ value , $ fixed ) ; return true ; } if ( \ is_array ( $ value ) ) { // Array get parsed by FromArray return ( false !== ( $ size = self :: FromArray ( $ value , $ fixed ) ) ) ; } if ( \ is_string ( $ value ) ) { // String get parsed by FromString return ( false !== ( $ size = self :: FromString ( $ value , $ fixed ) ) ) ; } if ( \ is_resource ( $ value ) && \ get_resource_type ( $ value ) === 'gd' ) { try { $ size = new Size ( \ imagesx ( $ value ) , \ imagesy ( $ value ) , $ fixed ) ; return true ; } catch ( \ Throwable $ ex ) { $ ex = null ; return false ; } } return false ; }
Tries to parse the the defined values as a size and returns the success state.

If parsing was successful (TRUE is returned) the resulting Beluga\Drawing\Size is
returned by the $size parameter.

@param  mixed            $value int|double|array|string|image-resource
@param  \Beluga\Drawing\Size $size  The resulting {@see \Beluga\Drawing\Size} instance.
@param  bool             $fixed     Is this instance fixed? (fixed is the read-only mode).
@return boolean
Tries to parse the the defined values as a size and returns the success state .