Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/app/code/Cnc/SerialNumber/Ui/Component/Listing/Column/StateOfWear/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/old/app/code/Cnc/SerialNumber/Ui/Component/Listing/Column/StateOfWear/Options.php
<?php
/**
 * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @author Radosław Łańcucki <[email protected]>
 * @copyright Copyright (c) 2022 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com)
 */
declare(strict_types=1);

namespace Cnc\SerialNumber\Ui\Component\Listing\Column\StateOfWear;

use Cnc\Catalog\Model\ResourceModel\StateOfWear\CollectionFactory;
use Magento\Framework\Data\OptionSourceInterface;

class Options implements OptionSourceInterface
{
    /**
     * @var array
     */
    protected $options;

    /**
     * @var CollectionFactory
     */
    protected $collectionFactory;

    /**
     * Constructor
     *
     * @param CollectionFactory $collectionFactory
     */
    public function __construct(CollectionFactory $collectionFactory)
    {
        $this->collectionFactory = $collectionFactory;
    }

    /**
     * Get options
     *
     * @return array
     */
    public function toOptionArray()
    {
        if ($this->options === null) {
            $options = $this->collectionFactory->create()->toOptionArray();

            foreach ($options as $option) {
                $this->options[] = [
                    'value' => $option['label'],
                    'label' => $option['label']
                ];
            }
        }
        return $this->options;
    }
}

Spamworldpro Mini