This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,50 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\SearchCriteria;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
class CollectionProcessor implements CollectionProcessorInterface
{
/**
* @var CollectionProcessorInterface[]
*/
private $processors;
/**
* @param CollectionProcessorInterface[] $processors
*/
public function __construct(
array $processors
) {
$this->processors = $processors;
}
/**
* @inheritDoc
*/
public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection)
{
foreach ($this->processors as $name => $processor) {
if (!($processor instanceof CollectionProcessorInterface)) {
throw new \InvalidArgumentException(
sprintf('Processor %s must implement %s interface.', $name, CollectionProcessorInterface::class)
);
}
$processor->process($searchCriteria, $collection);
}
}
}
@@ -0,0 +1,32 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\SearchCriteria;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
interface CollectionProcessorInterface
{
/**
* Apply Search Criteria to Collection
*
* @param SearchCriteriaInterface $searchCriteria
* @param AbstractDb $collection
* @throws \InvalidArgumentException
* @return void
* @since 100.2.0
*/
public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection);
}
@@ -0,0 +1,44 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\Serialize\Serializer;
class Json
{
/**
* {@inheritDoc}
* @since 100.2.0
*/
public function serialize($data)
{
$result = json_encode($data);
if (false === $result) {
throw new \InvalidArgumentException('Unable to serialize value.');
}
return $result;
}
/**
* {@inheritDoc}
* @since 100.2.0
*/
public function unserialize($string)
{
$result = json_decode($string, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException('Unable to unserialize value.');
}
return $result;
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\Stdlib;
class ArrayManager extends \Magento\Framework\Stdlib\ArrayManager
{
/**
* Finds node in nested array and saves its index and parent node reference
*
* @param string $path
* @param array $data
* @param string $delimiter
* @param bool $populate
* @return bool
*/
protected function find($path, array &$data, $delimiter, $populate = false)
{
if (is_array($path)) {
$path = implode($delimiter, $path);
}
return parent::find($path, $data, $delimiter, $populate);
}
}