Storage::delete PHP Method

delete() public method

public delete ( $key )
    public function delete($key)
    {
        $collection = $this->readCollection();
        if (isset($collection[self::VERSION]['jobs'][$key])) {
            if (is_array($collection[self::VERSION]['jobs'][$key]['tubes'])) {
                foreach ($collection[self::VERSION]['jobs'][$key]['tubes'] as $tubename => $val) {
                    unset($collection[self::VERSION]['tubes'][$tubename][$key]);
                }
            }
            unset($collection[self::VERSION]['jobs'][$key]);
            $this->writeCollection($collection);
        }
        return false;
    }

Usage Example

 public function testDeleteCompositeKey()
 {
     if (!$this->storage->supportsCompositePrimaryKeys()) {
         $this->markTestSkipped('Composite keys need to be supported for this test to run.');
     }
     $key = ['dist' => 'foo', 'range' => 100];
     $this->mockDeleteCompositeKey($key);
     $this->storage->delete('stdClass', $key);
 }
All Usage Examples Of Storage::delete