public function dequeue(array $options = array())
    {
        $match = false;
        foreach ($this->queue as $idx => $attributes) {
            if (isset($options["exclude"])) {
                $match = !in_array($attributes["type"], $options["exclude"]);
            } else {
                if (isset($options["only"])) {
                    $match = in_array($attributes["type"], $options["only"]);
                } else {
                    $match = true;
                }
            }

            if ($match) {
                $match = is_null($attributes['not_before']) || ($attributes['not_before'] <= new \DateTime());
            }

            if ($match) {
                array_splice($this->queue, $idx, 1);
                $attributes['status'] = 'locked';
                $this->locked[] = $attributes;
                return $attributes;
            }
        }
    }