예제 #1
0
function handleRequest($param)
{
    if (!is_numeric($param)) {
        return array('error' => 'You must pass a number');
    }
    $number = intval($param);
    if ($number < 1) {
        return array('error' => 'You must pass a number greater than 0');
    }
    $result = processFib($number);
    return array('result' => $result);
}
예제 #2
0
 public function testFib()
 {
     $excpected = array(1, 2, 3, 5, 8, 13);
     $actual = processFib(5);
     $this->assertEquals($excpected, $actual);
 }