PHP code example of codekandis / code-message-interpreter

1. Go to this page and download the library: Download codekandis/code-message-interpreter 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/ */

    

codekandis / code-message-interpreter example snippets


abstract class ErrorCodes
{
    public const ERROR_ONE   = 1;
    public const ERROR_TWO   = 2;
    public const ERROR_THREE = 3;
}

abstract class ErrorMessages
{
    public const ERROR_ONE   = 'Error one occurred.';
    public const ERROR_TWO   = 'Error two occurred.';
    public const ERROR_THREE = 'Error three occurred.';
}

/** returns 'Error two occurred.' */
( new CodeMessageInterpreter( ErrorCodes::class, ErrorMessages::class ) )
    ->interpret( ErrorCodes::ERROR_TWO );