public function add($settings)
    {
        if (is_array($settings)) {
            $settings = new $this->settings($settings);
        }

        if (!$settings instanceof ResourceSettings) {
            throw new InvalidInstanceException('Settings is not a valid instance of ' . ResourceSettings::class);
        }

        $settings->hasRequiredSettings();

        $settings->theme = $this->getThemeToUse($settings);

        $addKey = sprintf('_added.%s.%s', $settings->theme->getName(), $settings->key);

        if ($this->resources->has($addKey)) {
            $this->logger->warning("Key already exists in Themer: '{$settings->key}'");
            return;
        }

        if ($this->addResource($settings)) {
            $this->resources->add($addKey, true);

            ++$this->order;
        }
    }
public function add($settings)
    {
        if (is_array($settings)) {
            $settings = new $this->settings($settings);
        }

        if (!$settings instanceof ResourceSettings) {
            throw new InvalidInstanceException('Settings is not a valid instance of ' . ResourceSettings::class);
        }

        $settings->hasRequiredSettings();

        $settings->theme = $this->getThemeToUse($settings);

        $addKey = sprintf('_added.%s.%s', $settings->theme->getName(), $settings->key);

        if ($this->resources->has($addKey)) {
            $this->logger->warning("Key already exists in Themer: '{$settings->key}'");
            return;
        }

        if ($this->addResource($settings)) {
            $this->resources->add($addKey, true);

            ++$this->order;
        }
    }
public function add ( $ settings ) { if ( is_array ( $ settings ) ) { $ settings = new $ this -> settings ( $ settings ) ; } if ( ! $ settings instanceof ResourceSettings ) { throw new InvalidInstanceException ( 'Settings is not a valid instance of ' . ResourceSettings :: class ) ; } $ settings -> hasRequiredSettings ( ) ; $ settings -> theme = $ this -> getThemeToUse ( $ settings ) ; $ addKey = sprintf ( '_added.%s.%s' , $ settings -> theme -> getName ( ) , $ settings -> key ) ; if ( $ this -> resources -> has ( $ addKey ) ) { $ this -> logger -> warning ( "Key already exists in Themer: '{$settings->key}'" ) ; return ; } if ( $ this -> addResource ( $ settings ) ) { $ this -> resources -> add ( $ addKey , true ) ; ++ $ this -> order ; } }
Add and track a new resource

@param \Laranix\Themer\ResourceSettings|array $settings
@throws \Laranix\Support\Exception\InvalidInstanceException
@throws \Laranix\Support\Exception\InvalidTypeException
Add and track a new resource