/home/sharedstore/public_html/prestashop.sharedstore.ma/src/Adapter/Language
Edit: /home/sharedstore/public_html/prestashop.sharedstore.ma/src/Adapter/Language/LanguageActivator.php (1958B)
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
namespace PrestaShop\PrestaShop\Adapter\Language;
use Language;
use PrestaShop\PrestaShop\Core\Language\LanguageActivatorInterface;
/**
* Class LanguageActivator is responsible for activating/deactivating language.
*/
final class LanguageActivator implements LanguageActivatorInterface
{
/**
* {@inheritdoc}
*/
public function enable($langId)
{
$this->setActive($langId, true);
}
/**
* {@inheritdoc}
*/
public function disable($langId)
{
$this->setActive($langId, false);
}
/**
* Enable/disable language.
*
* @param int $langId
* @param bool $status
*/
private function setActive($langId, $status)
{
$lang = new Language((int) $langId);
if ($lang->active !== $status) {
$lang->active = $status;
$lang->save();
}
}
}