DebugKit\DebugMemory::getAll PHP Method

getAll() public static method

Get all the stored memory points
public static getAll ( boolean $clear = false ) : array
$clear boolean Whether you want to clear the memory points as well. Defaults to false.
return array Array of memory marks stored so far.
    public static function getAll($clear = false)
    {
        $marks = self::$_points;
        if ($clear) {
            self::$_points = [];
        }
        return $marks;
    }

Usage Example

 /**
  * test making memory use markers.
  *
  * @return void
  */
 public function testMemorySettingAndGetting()
 {
     DebugMemory::clear();
     $result = DebugMemory::record('test marker');
     $this->assertTrue($result);
     $result = DebugMemory::getAll(true);
     $this->assertEquals(count($result), 1);
     $this->assertTrue(isset($result['test marker']));
     $this->assertTrue(is_numeric($result['test marker']));
     $result = DebugMemory::getAll();
     $this->assertTrue(empty($result));
     DebugMemory::record('test marker');
     DebugMemory::record('test marker');
     $result = DebugMemory::getAll();
     $this->assertEquals(count($result), 2);
     $this->assertTrue(isset($result['test marker']));
     $this->assertTrue(isset($result['test marker #2']));
 }
All Usage Examples Of DebugKit\DebugMemory::getAll