Your IP : 216.73.216.250


Current Path : /home/digilove/public_html/plugins/system/forseo/vendor/weeblr/forseo/api/controller/
Upload File :
Current File : /home/digilove/public_html/plugins/system/forseo/vendor/weeblr/forseo/api/controller/platform.php

<?php
/**
 * Project: 4SEO
 *
 * @package          4SEO
 * @copyright        Copyright Weeblr llc - 2020-2024
 * @author           Yannick Gaultier - Weeblr llc
 * @license          GNU General Public License version 3; see LICENSE.md
 * @version          6.2.0.2478
 * @date        2024-10-03
 */

namespace Weeblr\Forseo\Api\Controller;

use Weeblr\Wblib\Forseo\Wb;
use Weeblr\Wblib\Forseo\Base;
use Weeblr\Wblib\Forseo\System as WblSystem;
use Weeblr\Wblib\Forseo\Api;

// no direct access
defined('_JEXEC') || defined('WBLIB_EXEC') || die;

class Platform extends Api\Controller
{
	/**
	 * Update a platform setting.
	 *
	 * @param $request
	 * @param $options
	 *
	 * @return array|\Exception
	 */
	public function patch($request, $options)
	{
		try
		{
			$data = $request->getBody();
			$data = Wb\arrayEnsure($data);
			foreach ($data as $action => $parameter)
			{
				if ('offline' === $action)
				{
					$this->platform->persistOfflineMode($parameter);
				}
			}

			return [
				'data' => $data,
			];
		}
		catch (\Throwable $e)
		{
			$this->factory->getThe('forseo.logger')->error('%s::%d %s - %s', $e->getFile(), $e->getLine(), $e->getMessage(), $e->getTraceAsString());

			return new \Exception('Internal error. See error log file.', WblSystem\Http::RETURN_INTERNAL_ERROR);
		}
	}
}