CoreFiles by mySites.guru
FiberCaster.php46 lines, 1,099 bytes, from Joomla_5.3.2-Stable-Full_Package.zip
Raw History Compare with 5.3.1
md5
c065c1b34940de4e6a6ed0b2fc597b7f
sha1
2153097b330db187953a098f24fc67c85c9b7417
sha256
1334e07e1d8f8e881daa5773f5a3015d45e5176766260cfaf2513e2fde14de20
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;

/**
 * Casts Fiber related classes to array representation.
 *
 * @author GrĂ©goire Pineau <[email protected]>
 */
final class FiberCaster
{
    /**
     * @return array
     */
    public static function castFiber(\Fiber $fiber, array $a, Stub $stub, bool $isNested, int $filter = 0)
    {
        $prefix = Caster::PREFIX_VIRTUAL;

        if ($fiber->isTerminated()) {
            $status = 'terminated';
        } elseif ($fiber->isRunning()) {
            $status = 'running';
        } elseif ($fiber->isSuspended()) {
            $status = 'suspended';
        } elseif ($fiber->isStarted()) {
            $status = 'started';
        } else {
            $status = 'not started';
        }

        $a[$prefix.'status'] = $status;

        return $a;
    }
}

The same content is in 108 releases, Joomla 5.0.0-alpha2 to 6.0.0-alpha3. See them all, or every version of this file.