PHP code example of komtaki / visibility-recommender

1. Go to this page and download the library: Download komtaki/visibility-recommender library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

komtaki / visibility-recommender example snippets


declare(strict_types=1);

commender\Commands\RecommendConstVisibility;

// The directory or file name where the file you want to modify may be used.
$autoloadDirs = [__DIR__ . '/../tests/Fake/FixMe'];

// The directory or file name that you want to modify.
$targetDir = __DIR__ . '/../tests/Fake/FixMe';

// Convert
(new RecommendConstVisibility($autoloadDirs, $targetDir))->run();

declare(strict_types=1);

class Mail
{
    // not used
    const STATUS_YET = 0;
    // used by command class
    const STATUS_PROCESS = 1;
    // not used
    public const STATUS_DONE = 2;
    // used by view
    const STATUS_CANCEL = 99;
}


class MailCommand
{
    const PROTECTED_USE_BY_SELF = true;

    const PROTECTED_USE_BY_CHILD = 200;

    const PROTECTED_USE_BY_GRAND_CHILD = true;

    public function run()
    {
        echo Mail::STATUS_PROCESS;
    }

    public function getStatus()
    {
        return static::PROTECTED_USE_BY_SELF;
    }
}

class ExtendsMailCommand extends MailCommand
{
    const PROTECTED_OVERRIDE = false;

    public function run()
    {
        return self::PROTECTED_USE_BY_CHILD;
    }
}

class NestExtendsMailCommand extends ExtendsMailCommand
{
    const PROTECTED_OVERRIDE =true;

    public function run()
    {
        return self::PROTECTED_USE_BY_GRAND_CHILD;
    }
}

<p> echo Mail::STATUS_CANCEL; 

./tests/Fake/FixMe/
├── Mail.php
├── commands
│   ├── ExtendsMailCommand.php
│   ├── MailCommand.php
│   └── NestExtendsMailCommand.php
└── views
    └── index.php