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); /** * CakePHP(tm) : Rapid Development Framework (https://..

Decoded Output download

<?php
declare(strict_types=1);

/**
 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 * @since         3.0.0
 * @license       https://opensource.org/licenses/mit-license.php MIT License
 */
namespace TestApp\Model\Table;

use Cake\ORM\Query\SelectQuery;
use Cake\ORM\Table;

/**
 * Author table class
 */
class AuthorsTable extends Table
{
    /**
     * @param array<string, mixed> $config
     * @return void
     */
    public function initialize(array $config): void
    {
        $this->hasMany('articles');
    }

    /**
     * @param \Cake\ORM\Query\SelectQuery $query
     * @param int|null $authorId
     * @return \Cake\ORM\Query\SelectQuery
     */
    public function findByAuthor(SelectQuery $query, ?int $authorId = null): SelectQuery
    {
        if ($authorId !== null) {
            $query->where(['Articles.id' => $authorId]);
        }

        return $query;
    }

    /**
     * Finder that applies a formatter to test dirty associations
     *
     * @param \Cake\ORM\Query\SelectQuery $query The query
     * @param array<string, mixed> $options The options
     * @return \Cake\ORM\Query\SelectQuery
     */
    public function findFormatted(SelectQuery $query, array $options = []): SelectQuery
    {
        return $query->formatResults(function ($results) {
            return $results->map(function ($author) {
                $author->formatted = $author->name . '!!';

                return $author;
            });
        });
    }

    /**
     * Finder that accepts an option via a typed parameter.
     *
     * @param \Cake\ORM\Query\SelectQuery $query The query
     * @param int $id Author ID
     * @return \Cake\ORM\Query\SelectQuery
     */
    public function findWithIdArgument(SelectQuery $query, int $id): SelectQuery
    {
        return $query->where(['id' => $id]);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
declare(strict_types=1);

/**
 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 * @since         3.0.0
 * @license       https://opensource.org/licenses/mit-license.php MIT License
 */
namespace TestApp\Model\Table;

use Cake\ORM\Query\SelectQuery;
use Cake\ORM\Table;

/**
 * Author table class
 */
class AuthorsTable extends Table
{
    /**
     * @param array<string, mixed> $config
     * @return void
     */
    public function initialize(array $config): void
    {
        $this->hasMany('articles');
    }

    /**
     * @param \Cake\ORM\Query\SelectQuery $query
     * @param int|null $authorId
     * @return \Cake\ORM\Query\SelectQuery
     */
    public function findByAuthor(SelectQuery $query, ?int $authorId = null): SelectQuery
    {
        if ($authorId !== null) {
            $query->where(['Articles.id' => $authorId]);
        }

        return $query;
    }

    /**
     * Finder that applies a formatter to test dirty associations
     *
     * @param \Cake\ORM\Query\SelectQuery $query The query
     * @param array<string, mixed> $options The options
     * @return \Cake\ORM\Query\SelectQuery
     */
    public function findFormatted(SelectQuery $query, array $options = []): SelectQuery
    {
        return $query->formatResults(function ($results) {
            return $results->map(function ($author) {
                $author->formatted = $author->name . '!!';

                return $author;
            });
        });
    }

    /**
     * Finder that accepts an option via a typed parameter.
     *
     * @param \Cake\ORM\Query\SelectQuery $query The query
     * @param int $id Author ID
     * @return \Cake\ORM\Query\SelectQuery
     */
    public function findWithIdArgument(SelectQuery $query, int $id): SelectQuery
    {
        return $query->where(['id' => $id]);
    }
}

Function Calls

None

Variables

None

Stats

MD5 5e4b8a0d498b7e8ab5099ea8750be187
Eval Count 0
Decode Time 84 ms