Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * This file is part of Flarum. * * For detailed copyright and license informa..
Decoded Output download
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\ExtensionManager\Exception;
use Composer\Semver\Semver;
use Flarum\ExtensionManager\Event\FlarumUpdated;
use Flarum\ExtensionManager\Settings\LastUpdateRun;
class MajorUpdateFailedException extends ComposerCommandFailedException
{
private const INCOMPATIBLE_REGEX = '/^ +- (?<ext>[A-z0-9\/-]+) [A-z0-9.-_\/]+ requires flarum\/core (?<coreReq>(?:[A-z0-9.><=_ -](?!->))+)/m';
public function __construct(
string $packageName,
string $output,
private readonly string $majorVersion
) {
parent::__construct($packageName, $output);
}
public function guessCause(): ?string
{
if (preg_match_all(self::INCOMPATIBLE_REGEX, $this->getMessage(), $matches) !== false) {
$this->details['incompatible_extensions'] = [];
foreach ($matches['ext'] as $k => $name) {
if (! Semver::satisfies($this->majorVersion, $matches['coreReq'][$k])) {
$this->details['incompatible_extensions'][] = $name;
}
}
resolve(LastUpdateRun::class)
->for(FlarumUpdated::MAJOR)
->with('status', LastUpdateRun::FAILURE)
->with('incompatibleExtensions', $this->details['incompatible_extensions'])
->save();
return 'extensions_incompatible_with_new_major';
}
return null;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\ExtensionManager\Exception;
use Composer\Semver\Semver;
use Flarum\ExtensionManager\Event\FlarumUpdated;
use Flarum\ExtensionManager\Settings\LastUpdateRun;
class MajorUpdateFailedException extends ComposerCommandFailedException
{
private const INCOMPATIBLE_REGEX = '/^ +- (?<ext>[A-z0-9\/-]+) [A-z0-9.-_\/]+ requires flarum\/core (?<coreReq>(?:[A-z0-9.><=_ -](?!->))+)/m';
public function __construct(
string $packageName,
string $output,
private readonly string $majorVersion
) {
parent::__construct($packageName, $output);
}
public function guessCause(): ?string
{
if (preg_match_all(self::INCOMPATIBLE_REGEX, $this->getMessage(), $matches) !== false) {
$this->details['incompatible_extensions'] = [];
foreach ($matches['ext'] as $k => $name) {
if (! Semver::satisfies($this->majorVersion, $matches['coreReq'][$k])) {
$this->details['incompatible_extensions'][] = $name;
}
}
resolve(LastUpdateRun::class)
->for(FlarumUpdated::MAJOR)
->with('status', LastUpdateRun::FAILURE)
->with('incompatibleExtensions', $this->details['incompatible_extensions'])
->save();
return 'extensions_incompatible_with_new_major';
}
return null;
}
}
Function Calls
None |
Stats
MD5 | 0b84d37eec53d5c02ad9fbcf54dc5edf |
Eval Count | 0 |
Decode Time | 97 ms |