PHP code example of tomasvotruba / cognitive-complexity
1. Go to this page and download the library: Download tomasvotruba/cognitive-complexity 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/ */
tomasvotruba / cognitive-complexity example snippets
function get_words_from_number(int $number): string
{
$amountInWords = '';
if ($number === 1) { // + 1
$amountInWords = 'one';
} elseif ($number === 2) { // + 1
$amountInWords = 'couple';
} elseif ($number === 3) { // + 1
$amountInWords = 'a few';
} else { // + 1
$amountInWords = 'a lot';
}
return $amountInWords;
}