From c18ecd0f01bf314ebacc2d1c0759b4892d994c2d Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 13 Feb 2024 13:05:29 +0100 Subject: [PATCH] #12864 added halfpastfouram in phpchartjs --- .../artica/phpchartjs/src/ChartInterface.php | 2 +- .../phpchartjs/src/Collection/ArrayAccess.php | 123 ++++++++++++++++++ .../src/Collection/ArrayAccessInterface.php | 42 ++++++ .../Collection/ArraySerializableInterface.php | 17 +++ .../phpchartjs/src/Collection/Collection.php | 114 ++++++++++++++++ .../src/Collection/CollectionInterface.php | 23 ++++ .../artica/phpchartjs/src/Collection/Data.php | 2 +- .../phpchartjs/src/DataSetCollection.php | 2 +- .../phpchartjs/src/LabelsCollection.php | 2 +- .../src/Options/Scales/RAxisCollection.php | 2 +- .../src/Options/Scales/XAxisCollection.php | 2 +- .../src/Options/Scales/YAxisCollection.php | 2 +- .../phpchartjs/src/PluginsCollection.php | 2 +- .../phpchartjs/test/unit/DataSetTest.php | 2 +- 14 files changed, 328 insertions(+), 9 deletions(-) create mode 100644 pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccess.php create mode 100644 pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php create mode 100644 pandora_console/vendor/artica/phpchartjs/src/Collection/ArraySerializableInterface.php create mode 100644 pandora_console/vendor/artica/phpchartjs/src/Collection/Collection.php create mode 100644 pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php diff --git a/pandora_console/vendor/artica/phpchartjs/src/ChartInterface.php b/pandora_console/vendor/artica/phpchartjs/src/ChartInterface.php index 94c18c3b56..3cb3c6425d 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/ChartInterface.php +++ b/pandora_console/vendor/artica/phpchartjs/src/ChartInterface.php @@ -2,7 +2,7 @@ namespace Artica\PHPChartJS; -use Halfpastfour\Collection\CollectionInterface; +use Artica\PHPChartJS\Collection\CollectionInterface; /** * Interface ChartInterface diff --git a/pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccess.php b/pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccess.php new file mode 100644 index 0000000000..5795a78709 --- /dev/null +++ b/pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccess.php @@ -0,0 +1,123 @@ +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 ); + } +} \ No newline at end of file diff --git a/pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php b/pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php new file mode 100644 index 0000000000..73d5c5868e --- /dev/null +++ b/pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php @@ -0,0 +1,42 @@ +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 ); + } +} \ No newline at end of file diff --git a/pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php b/pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php new file mode 100644 index 0000000000..1450b599b0 --- /dev/null +++ b/pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php @@ -0,0 +1,23 @@ +