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 declare(strict_types=1); namespace Doctrine\Tests\Models\StockExchange; use Doctr..

Decoded Output download

<?php

declare(strict_types=1);

namespace Doctrine\Tests\Models\StockExchange;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\Table;

#[Table(name: 'exchange_markets')]
#[Entity]
class Market
{
    #[Id]
    #[Column(type: 'integer')]
    #[GeneratedValue]
    private int $id;

    /** @psalm-var ArrayCollection<string, Stock> */
    #[OneToMany(targetEntity: 'Stock', mappedBy: 'market', indexBy: 'symbol')]
    public $stocks;

    public function __construct(
        #[Column(type: 'string', length: 255)]
        private string $name,
    ) {
        $this->stocks = new ArrayCollection();
    }

    public function getId(): int
    {
        return $this->id;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function addStock(Stock $stock): void
    {
        $this->stocks[$stock->getSymbol()] = $stock;
    }

    public function getStock(string $symbol): Stock
    {
        return $this->stocks[$symbol];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Doctrine\Tests\Models\StockExchange;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\Table;

#[Table(name: 'exchange_markets')]
#[Entity]
class Market
{
    #[Id]
    #[Column(type: 'integer')]
    #[GeneratedValue]
    private int $id;

    /** @psalm-var ArrayCollection<string, Stock> */
    #[OneToMany(targetEntity: 'Stock', mappedBy: 'market', indexBy: 'symbol')]
    public $stocks;

    public function __construct(
        #[Column(type: 'string', length: 255)]
        private string $name,
    ) {
        $this->stocks = new ArrayCollection();
    }

    public function getId(): int
    {
        return $this->id;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function addStock(Stock $stock): void
    {
        $this->stocks[$stock->getSymbol()] = $stock;
    }

    public function getStock(string $symbol): Stock
    {
        return $this->stocks[$symbol];
    }
}

Function Calls

None

Variables

None

Stats

MD5 bbdb1beb529d3d9b421460542e427a3f
Eval Count 0
Decode Time 103 ms