PHP code example of djthossi / ensure

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

    

djthossi / ensure example snippets


class Message
{
    use EnsureIsStringTrait;
    
    const MESSAGE_IS_NOT_A_STRING = 1;
    
    /**
     * @param string $message
     */
    public function __construct($message)
    {
        $this->ensureIsString('Message', $message, self::MESSAGE_IS_NOT_A_STRING);
    }
}