PHP Classes

File: tests/src/BaseClass.php

Recommend this page to a friend!
  Classes of Rodolfo Berrios Arce   Var-Dump   tests/src/BaseClass.php   Download  
File: tests/src/BaseClass.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Var-Dump
Show the value of a variable in colored way
Author: By
Last change:
Date: 1 month ago
Size: 1,533 bytes
 

Contents

Class file image Download
<?php

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

declare(strict_types=1);

namespace
Chevere\Tests\src;

use
Chevere\DataStructure\Map;
use
stdClass;

abstract class
BaseClass
{
    public const
CONSTANT = 'constant';

    public static
string $static = 'static';

    public
int $code = 101;

    public
object $public;

    public
readonly string $readonly;

    private
object $private;

    private
object $protected;

    private
object $circularReference;

    private
object $deep;

    public function
withPrivate(): self
   
{
       
$new = clone $this;
       
$new->private = new Map(test: 'some');

        return
$new;
    }

    public function
withProtected(): self
   
{
       
$new = clone $this;
       
$new->protected = new stdClass();

        return
$new;
    }

    public function
withPublic(): self
   
{
       
$new = clone $this;
       
$new->public = new stdClass();
       
$new->public->string = 'string';
       
$new->public->array = [];
       
$new->public->int = 1;
       
$new->public->bool = true;

        return
$new;
    }

    public function
withCircularReference(): self
   
{
       
$new = clone $this;
       
$new->circularReference = $new;

        return
$new;
    }

    public function
withDeep($deep): self
   
{
       
$new = clone $this;
       
$new->deep = $deep;

        return
$new;
    }
}