Ejemplo n.º 1
0
 /**
  * Read content from file
  *
  * @param int  $length  Length of content to read
  * @param bool $asArray Get as array
  *
  * @return array|string|bool
  */
 public function read($length = 0, $asArray = false)
 {
     if ($asArray && Number::isZero($length)) {
         return file($this->file);
     } elseif (Number::isPositive($length)) {
         $this->setHandle('r');
         return fread($this->handle, $length);
     } else {
         return Collection::implode($this->read(0, true), '');
     }
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public function testIsPositiveWithWrongDatatype()
 {
     /** @noinspection PhpParamsInspection */
     $this->assertFalse(Number::isPositive('abc'));
 }