<?php
namespace WPT\MLSL\Blocks\StoreLocator;

/**
 * Selectors.
 */
class Selectors
{
    protected $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

    public function get($name)
    {
        $selectors = $this->all();

        if (isset($selectors[$name])) {
            $selector = $selectors[$name]['selector'];

            $selector = str_replace('%%order_class%%', $this->id, $selector);

            return $selector;
        }

        return 'nas';
    }

    public function all()
    {
        $fields = new \WPT_MLSL_Divi_Modules\StoreLocatorModule\Fields(null);

        return $fields->get_selectors();
    }
}
