Remove unused series & values
@param array $Data
@param array $Palette
@param string $DataSerie
@param string $AbscissaSerie
@return array
973406
public function clean0Values(array $Data, array $Palette, $DataSerie, $AbscissaSerie)
    {
        $NewPalette = [];
        $NewData = [];
        $NewAbscissa = [];

        /* Remove unused series */
        foreach (array_keys($Data["Series"]) as $SerieName) {
            if ($SerieName != $DataSerie && $SerieName != $AbscissaSerie) {
                unset($Data["Series"][$SerieName]);
            }
        }

        /* Remove null values */
        foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value) {
            if ($Value != 0) {
                $NewData[] = $Value;
                $NewAbscissa[] = $Data["Series"][$AbscissaSerie]["Data"][$Key];
                if (isset($Palette[$Key])) {
                    $NewPalette[] = $Palette[$Key];
                }
            }
        }
        $Data["Series"][$DataSerie]["Data"] = $NewData;
        $Data["Series"][$AbscissaSerie]["Data"] = $NewAbscissa;

        return [$Data, $NewPalette];
    }
173415
protected function filterValues(array $data)
    {
        foreach ($data as $key => $value) {
            if (is_int($key)) {
                unset($data[$key]);
            }
        }

        return $data;
    }
309987
private function processCspan($data) {
		$rspan = Array();
		for ($i = 0; $i < count($data); $i++) {
			$last = 0;
			$rspan[$i] = Array();
			for ($j = 0; $j < count($data[$i]); $j++) {
				$rspan[$i][$j] = 0;
				if ($data[$i][$j] === '#cspan') {
					$rspan[$i][$last]++;
				} else {
					$last = $j;
				}
			}
		}
		return $rspan;
	}
507096
private static function removeDots(&$ac, &$ai)
    {
        $i = count($ai);
        $j = count($ac) - 1;
        for ($k = 0; $k < $i; $k++) {
            $byte0 = 0;
            do {
                $l = $ai[$k];
                if ($ac[$l] === '.') {

                    if (($l == $j) || ($ac[$l + 1] === '')) {
                        $byte0 = 1;
                        break;
                    } else if ($ac[$l + 1] === '.' && $l + 1 == $j || $ac[$l + 2] === '') {
                        $byte0 = 2;
                        break;
                    }
                }
            } while (++$k < $i);

            if ($k > $i || $byte0 === 0) {
                break;
            } elseif ($byte0 === 1) {
                $ai[$k] = -1;
            } else {
                //$i1;
                for ($i1 = $k - 1; $i1 >= 0; $i1--) {
                    if ($ai[$i1] !== -1) break;
                }
                if ($i1 >= 0) {
                    $j1 = $ai[$i1];
                    if ($ac[$j1] !== '.' || $ac[$j1 + 1] !== '.' || $ac[$j1 + 2] !== '') {
                        $ai[$k] = -1;
                        $ai[$i1] = -1;
                    }
                }
            }
        }

    }
207388
private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') {
		$seriesVal = array();
		$formatCode = '';
		$pointCount = 0;

		foreach($seriesValueSet as $seriesValueIdx => $seriesValue) {
			switch ($seriesValueIdx) {
				case 'ptCount':
					$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
					break;
				case 'formatCode':
					$formatCode = (string) $seriesValue;
					break;
				case 'pt':
					$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
					if ($dataType == 's') {
						$seriesVal[$pointVal] = (string) $seriesValue->v;
					} else {
						$seriesVal[$pointVal] = (float) $seriesValue->v;
					}
					break;
			}
		}

		if (empty($seriesVal)) {
			$seriesVal = NULL;
		}

		return array( 'formatCode'	=> $formatCode,
					  'pointCount'	=> $pointCount,
					  'dataValues'	=> $seriesVal
					);
	}
582542
private static function deleteLinkedContent(string $entity, array $data)
    {
        $info = Metadados::getInfo($entity);
        $dic = Metadados::getDicionario($entity);
        if ($info && isset($data['id'])) {

            /*   REMOVE EXTEND MULT  */
            if ($info['extend_mult']) {
                foreach ($info['extend_mult'] as $item) {
                    $read = new Read();
                    $read->exeRead(PRE . $entity . "_" . $dic[$item]['relation'] . "_" . $dic[$item]['column'], "WHERE {$entity}_id = :id", "id={$data['id']}");
                    if ($read->getResult()) {
                        foreach ($read->getResult() as $i)
                            self::deleteExtend($dic[$item]['relation'], $i[$dic[$item]['relation'] . "_id"]);
                    }
                }
            }

            /*   REMOVE EXTEND   */
            if ($info['extend']) {
                foreach ($info['extend'] as $item)
                    self::deleteExtend($dic[$item]['relation'], $data[$dic[$item]['column']]);
            }

            /*   REMOVE SOURCES   */
            foreach ($dic as $id => $c) {
                if ($c['key'] === "source" && !empty($data[$c['column']])) {
                    $read = new Read();
                    $read->exeRead(PRE . $entity, "WHERE id != :id && " . $c['column'] . " = :s", "id={$data['id']}&s={$data[$c['column']]}");
                    if (!$read->getResult() && file_exists(PATH_HOME . $data[$c['column']]))
                        unlink(PATH_HOME . $data[$c['column']]);
                }
            }
        }
    }
238306
protected function filter($data)
    {
        $index = -1;

        foreach ($data as $key => $value) {
            $index++;

            if (is_array($value)) {
                $data[$key] = $this->filter($value);

                continue;
            }

            if (is_numeric($key) && $value instanceof MergeValue) {
                return $this->mergeData(
                    $data, $index, $this->filter($value->data),
                    array_values($value->data) === $value->data
                );
            }

            if ($value instanceof self && is_null($value->resource)) {
                $data[$key] = null;
            }
        }

        return $this->removeMissingValues($data);
    }
951046
final protected function serializeBasicDataset($dataset): array
    {
        $key = $this->resolveSerializerKey($dataset);

        if ($dataset instanceof Paginator) {
            $collection = $dataset->toArray();

            $collection[$key] = $collection['data'];
            unset($collection['data']);

            return $collection;
        }

        return [
            $key => $dataset->toArray(),
        ];
    }
1066772
public function stripResponseData(array $data)
	{
		if (isset($data[self::getEntityName()]) && is_array($data[self::getEntityName()]))
			$data = $data[self::getEntityName()];

		if (isset($data[self::getSingularEntityName()]) && is_array($data[self::getSingularEntityName()]))
			$data = $data[self::getSingularEntityName()];

		return $data;
	}
1261411
public static function split(DataSet $dataSet, float $split): array
    {
        if ($split <= 0 || $split > 1) {
            throw new WrongUsageException('The split must be between 0 and 1');
        }

        $data = $dataSet->getRawData();
        $dataCount = floor($dataSet->getSize() * $split);
        if ($dataCount == 0) {
            $dataCount++;
        }
        $randomKeys = array_rand($data, $dataCount);
        $randomKeys = is_array($randomKeys)? $randomKeys : [$randomKeys];
        $data1 = $data2 = [];

        foreach ($data as $index => $row) {
            if (in_array($index, $randomKeys)) {
                $data1[] = $row;
            } else {
                $data2[] = $row;
            }
        }


        $dataSet1 = self::create($data1);
        $dataSet1->prepare($dataSet->getMapper());

        $dataSet2 = self::create($data2);
        $dataSet2->prepare($dataSet->getMapper());

        return [$dataSet1, $dataSet2];
    }
426319
private function purgeOrphanedToCreateItems(array &$data)
    {
        foreach ($data['toCreate'] as $key => $timestamp) {
            $time = $this->time();

            if ($timestamp + self::DURATION_TWENTY_MINUTES < $this->time()) {
                unset($data['toCreate'][$key]);
            }
        }
    }
829886
public function unredislizeArray(array $data)
    {
        $result = [];
        foreach ($data as $key => $value) {
            $result[$key] = $this->unredislize($value);
        }

        return $result;
    }
816723
public function emptyTo(& $colorData, $count) 
    {
        for ($i = 0; $i < $count; $i++) {
            $sampleCount = $this->samples[$i * 5 + self::IDX_COUNT];
            $a = $this->samples[$i * 5 + self::IDX_A];
            $color = $sampleCount == 0 || $a == 0 ? 0 :
                ColorUtils::from(
                    (int)($a / $sampleCount),
                    (int)($this->samples[$i * 5 + self::IDX_R] / $a),
                    (int)($this->samples[$i * 5 + self::IDX_G] / $a),
                    (int)($this->samples[$i * 5 + self::IDX_B] / $a)
                );
            
            $colorData[] = 1;
            $colorData[] = $color;
        }
        
        $this->pixelOffset = 0;
        $this->subPixelOffset = 0;
        $this->used = -1;
    }
742390
public static function show(array $data, array $opts = []): void
    {
        $stringList = [];
        $ignoreEmpty = $opts['ignoreEmpty'] ?? true;
        $lastNewline = true;

        $opts['returned'] = true;
        if (isset($opts['lastNewline'])) {
            $lastNewline = $opts['lastNewline'];
            unset($opts['lastNewline']);
        }

        foreach ($data as $title => $list) {
            if ($ignoreEmpty && !$list) {
                continue;
            }

            $stringList[] = SingleList::show($list, $title, $opts);
        }

        Console::write(\implode("\n", $stringList), $lastNewline);
    }
238174
protected function _cleanupData(array $data = array())
    {
        $clean = array();

        foreach ($data as $key => $value)
        {
            if (!empty($value)) {
                $clean[$key] = $value;
            }
        }

        return $clean;
    }
845606
private static function separate(array $data)
    {
        $array = [];

        foreach ($data as $provider) {

            if(($bool = self::isDelim($provider)) === false) {
                $array['required'][] = $provider;
            }
            else {
                if ($bool[1] === 'true') {
                    $array['required'][] = strval($bool[0]);
                } else {
                    $array['hidden'][] = strval($bool[0]);
                }
            }
        }

        return $array;

    }
760780
public function mergeData(array $data1, array $data2, $name = null, $separator = '.')
    {
        $nested = $this->getNested($name, $separator);

        if (!\is_array($nested)) {
            $nested = [];
        }

        return $this->mergeArrays($data1, $data2, $nested);
    }