mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
#12864 added halfpastfouram in phpchartjs
This commit is contained in:
parent
8422aba9d7
commit
c18ecd0f01
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS;
|
namespace Artica\PHPChartJS;
|
||||||
|
|
||||||
use Halfpastfour\Collection\CollectionInterface;
|
use Artica\PHPChartJS\Collection\CollectionInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface ChartInterface
|
* Interface ChartInterface
|
||||||
|
123
pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccess.php
vendored
Normal file
123
pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccess.php
vendored
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Collection;
|
||||||
|
|
||||||
|
use Artica\PHPChartJS\Collection\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ArrayAccess
|
||||||
|
* @package Artica\PHPChartJS\Collection\Collection
|
||||||
|
*/
|
||||||
|
class ArrayAccess extends Collection implements ArrayAccessInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check if the given offset exists in the set of data.
|
||||||
|
*
|
||||||
|
* @param mixed $offset The offset to check.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function offsetExists( $offset )
|
||||||
|
{
|
||||||
|
// Can not retrieve a key based on a value other than a string, integer or boolean
|
||||||
|
if( !is_string( $offset ) && !is_int( $offset ) && !is_bool( $offset ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_key_exists( $offset, $this->data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a value from the given offset.
|
||||||
|
*
|
||||||
|
* @param mixed $offset The offset to get the value from.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function offsetGet( $offset )
|
||||||
|
{
|
||||||
|
if( $this->offsetExists( $offset ) ) {
|
||||||
|
return $this->data[ $offset ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a value at the given offset.
|
||||||
|
*
|
||||||
|
* @param mixed $offset The offset to set the value at.
|
||||||
|
* @param mixed $value The value to set.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function offsetSet( $offset, $value )
|
||||||
|
{
|
||||||
|
$this->data[ $offset ] = $value;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset a value at the given offset. Does nothing if the offset is not found.
|
||||||
|
*
|
||||||
|
* @param mixed $offset The offset to unset the value from.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function offsetUnset( $offset )
|
||||||
|
{
|
||||||
|
if( $this->offsetExists( $offset ) ) {
|
||||||
|
unset( $this->data[ $offset ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide a callback to use for sorting the data.
|
||||||
|
*
|
||||||
|
* @param \Closure $callback The callback to be used.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function usort( \Closure $callback )
|
||||||
|
{
|
||||||
|
usort( $this->data, $callback );
|
||||||
|
reset( $this->data );
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the data by key.
|
||||||
|
*
|
||||||
|
* @param int $sortFlags Optional flags to provide to ksort.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function ksort( $sortFlags = null )
|
||||||
|
{
|
||||||
|
ksort( $this->data, $sortFlags );
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the rows of data the collection contains.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
return count( $this->data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ArrayIterator
|
||||||
|
*/
|
||||||
|
public function getIterator()
|
||||||
|
{
|
||||||
|
return new ArrayIterator( $this );
|
||||||
|
}
|
||||||
|
}
|
42
pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php
vendored
Normal file
42
pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface ArrayAccessInterface
|
||||||
|
* @package Artica\PHPChartJS\Collection\Collection
|
||||||
|
*/
|
||||||
|
interface ArrayAccessInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Should set the data for the collection and return the previous set of data.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function exchangeArray( array $data );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should perform the php function usort on the dataset.
|
||||||
|
*
|
||||||
|
* @param \Closure $callback
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function usort( \Closure $callback );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should perform the php function ksort on the dataset.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function ksort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the rows of data the collection contains.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count();
|
||||||
|
}
|
17
pandora_console/vendor/artica/phpchartjs/src/Collection/ArraySerializableInterface.php
vendored
Normal file
17
pandora_console/vendor/artica/phpchartjs/src/Collection/ArraySerializableInterface.php
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface ArraySerializableInterface
|
||||||
|
* @package Artica\PHPChartJS\Collection
|
||||||
|
*/
|
||||||
|
interface ArraySerializableInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Should return an array containing all values.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getArrayCopy();
|
||||||
|
}
|
114
pandora_console/vendor/artica/phpchartjs/src/Collection/Collection.php
vendored
Normal file
114
pandora_console/vendor/artica/phpchartjs/src/Collection/Collection.php
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Collection
|
||||||
|
* @package Artica\PHPChartJS\Collection
|
||||||
|
*/
|
||||||
|
abstract class Collection implements CollectionInterface, ArraySerializableInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The internal set of data.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $data = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection constructor.
|
||||||
|
*
|
||||||
|
* @param array|null $data
|
||||||
|
*/
|
||||||
|
public function __construct( array $data = null )
|
||||||
|
{
|
||||||
|
if( !is_null( $data ) ) {
|
||||||
|
$this->data = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value to the beginning of the set of data. This will change existing keys.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to prepend.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function prepend( $value )
|
||||||
|
{
|
||||||
|
array_unshift( $this->data, $value );
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value to the end of the set of data.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to append.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function append( $value )
|
||||||
|
{
|
||||||
|
array_push( $this->data, $value );
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shift an element off of the left of the collection.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function trimLeft()
|
||||||
|
{
|
||||||
|
return array_shift( $this->data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pop an element off of the right of the collection.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function trimRight()
|
||||||
|
{
|
||||||
|
return array_pop( $this->data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should return an array containing all values.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getArrayCopy()
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should set the data for the collection and return the previous set of data.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function exchangeArray( array $data )
|
||||||
|
{
|
||||||
|
// Gather return data
|
||||||
|
$returnArray = $this->getArrayCopy();
|
||||||
|
// Set the new data
|
||||||
|
$this->data = $data;
|
||||||
|
|
||||||
|
return $returnArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get (and create if not exists) an iterator.
|
||||||
|
*
|
||||||
|
* @return \ArrayIterator
|
||||||
|
*/
|
||||||
|
public function getIterator()
|
||||||
|
{
|
||||||
|
return new \ArrayIterator( $this->data );
|
||||||
|
}
|
||||||
|
}
|
23
pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php
vendored
Normal file
23
pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Artica\PHPChartJS\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface CollectionInterface
|
||||||
|
*/
|
||||||
|
interface CollectionInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param mixed $value
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function append( $value );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $value
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function prepend( $value );
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS\Collection;
|
namespace Artica\PHPChartJS\Collection;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use Artica\PHPChartJS\Delegate;
|
use Artica\PHPChartJS\Delegate;
|
||||||
use JsonSerializable as JsonSerializableInterface;
|
use JsonSerializable as JsonSerializableInterface;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS;
|
namespace Artica\PHPChartJS;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS;
|
namespace Artica\PHPChartJS;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS\Options\Scales;
|
namespace Artica\PHPChartJS\Options\Scales;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS\Options\Scales;
|
namespace Artica\PHPChartJS\Options\Scales;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS\Options\Scales;
|
namespace Artica\PHPChartJS\Options\Scales;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Artica\PHPChartJS;
|
namespace Artica\PHPChartJS;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Test;
|
namespace Test;
|
||||||
|
|
||||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||||
use Artica\PHPChartJS\Chart\Bar;
|
use Artica\PHPChartJS\Chart\Bar;
|
||||||
use Artica\PHPChartJS\ChartInterface;
|
use Artica\PHPChartJS\ChartInterface;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user