PHP code example of mootly / mp_errors

1. Go to this page and download the library: Download mootly/mp_errors 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/ */

    

mootly / mp_errors example snippets




if (!isset($mpo_errors)) { $mpo_errors  = new \mpc\mpc_errors(); }

if (!isset($mpo_secure)) { $mpo_secure  = new \mpc\mpc_secure($mpo_errors); }

$this->classRef = bin2hex(random_bytes(8)).'::'.get_class();

string status code => [ string severity, string message ]

'none'          => ['Notice'  ,'Success.'],
'noAction'      => ['Notice'  ,'No action taken.'],
'mpe_set00'     => ['Warning' ,'Some properties already exist and were not replaced.'],
'mpe_set01'     => ['Warning' ,'This property already exists and was not replaced.'],
'mpe_locked'    => ['Warning' ,'Requested property is locked from updates.'],
'mpe_secure'    => ['Warning' ,'Requested property is secured from further updates.'],
'unknown'       => ['Error'   ,'Unknown error code.'],
'mpe_null'      => ['Error'   ,'Requested value or property does not exist.'],
'mpe_nomethod'  => ['Error'   ,'Requested method does not exist.'],
'mpe_badURL'    => ['Error'   ,'Invalid URL.'],
'mpe_param00'   => ['Error'   ,'Invalid parameter.'],
'mpe_param01'   => ['Error'   ,'Invalid history length.'],
'mpe_param02'   => ['Error'   ,'Attempted to add invalid error message entry.'],
'mpe_param03'   => ['Error'   ,'Too few parameters.'],
'mpe_param04a'  => ['Error'   ,'Too many parameters.'],
'mpe_param04b'  => ['Warning' ,'Too many parameters. Not all were processed.'],

log => [
  success  => bool
  code     => string  // status code from status code array
  source   => string  // calling class and method
  severity => string  // severity from status code array
  message  => string  // message from status code array
]

public setStatus(string code, ?string source) : bool

public getStatus(int index) : array|bool

public getStatusCodes() : array

public getStatusCount() : int

public addStatusCodes(array codes, bool replace) : bool
json
"hp": ">=8.0.0",
  "mootly/mp_errors": "*",
}