Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -93,24 +93,26 @@ class _Chart
|
||||
$values = array_values( $values );
|
||||
foreach ( $this->headers as $data )
|
||||
{
|
||||
$value = \is_array( $values[ $i ] ) ? $values[ $i ]['value'] : $values[ $i ];
|
||||
|
||||
switch ( $data['type'] )
|
||||
{
|
||||
case 'string':
|
||||
if ( !\is_string( $values[ $i ] ) )
|
||||
if ( !\is_string( $value ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( "VALUE_{$i}_NOT_STRING" );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
if ( !\is_numeric( $values[ $i ] ) and !\is_null( $values[ $i ] ) )
|
||||
if ( !\is_numeric( $value ) and !\is_null( $value ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( "VALUE_{$i}_NOT_NUMBER" );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'bool':
|
||||
if ( !\is_bool( $values[ $i ] ) )
|
||||
if ( !\is_bool( $value ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( "VALUE_{$i}_NOT_BOOL" );
|
||||
}
|
||||
@@ -119,12 +121,19 @@ class _Chart
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
case 'timeofday':
|
||||
if ( !( $values[ $i ] instanceof \IPS\DateTime ) )
|
||||
if ( !( $value instanceof \IPS\DateTime ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( "VALUE_{$i}_NOT_DATETIME" );
|
||||
}
|
||||
|
||||
$values[ $i ] = $values[ $i ]->rfc3339();
|
||||
|
||||
if ( \is_array( $values[ $i ] ) )
|
||||
{
|
||||
$values[ $i ]['value'] = $value->rfc3339();
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[ $i ] = $value->rfc3339();
|
||||
}
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
|
||||
Reference in new issue
Block a user