@param string      $slotToElicit
@param Intent|null $intent

@return ElicitSlotDirective
552132
public static function create(string $slotToElicit, Intent $intent = null): self
    {
        $elicitSlotDirective = new self();

        $elicitSlotDirective->type          = self::TYPE;
        $elicitSlotDirective->slotToElicit  = $slotToElicit;
        $elicitSlotDirective->updatedIntent = $intent;

        return $elicitSlotDirective;
    }
1325240
protected function generateRedirectToDefaultSelection($categorySlug, $questionSlug)
    {
        $doRedirect = false;
        $config     = $this->container->getParameter('genj_faq');

        if (!$categorySlug && $config['select_first_category_by_default']) {
            $firstCategory = $this->getCategoryRepository()->retrieveFirst();
            if ($firstCategory instanceof \Genj\FaqBundle\Entity\Category) {
                $categorySlug = $firstCategory->getSlug();
                $doRedirect   = true;
            } else {
                throw $this->createNotFoundException('Tried to open the first faq category by default, but there was none.');
            }
        }

        if (!$questionSlug && $config['select_first_question_by_default']) {
            $firstQuestion = $this->getQuestionRepository()->retrieveFirstByCategorySlug($categorySlug);
            if ($firstQuestion instanceof \Genj\FaqBundle\Entity\Question) {
                $questionSlug = $firstQuestion->getSlug();
                $doRedirect   = true;
            } else {
                throw $this->createNotFoundException('Tried to open the first faq question by default, but there was none.');
            }
        }

        if ($doRedirect) {
            return $this->redirect(
                $this->generateUrl('genj_faq_faq_index', array('categorySlug' => $categorySlug, 'questionSlug' => $questionSlug), true)
            );
        }

        return false;
    }
1314643
private void removeSlot(SlotID slotId) {
		TaskManagerSlot slot = slots.remove(slotId);

		if (null != slot) {
			freeSlots.remove(slotId);

			if (slot.getState() == TaskManagerSlot.State.PENDING) {
				// reject the pending slot request --> triggering a new allocation attempt
				rejectPendingSlotRequest(
					slot.getAssignedSlotRequest(),
					new Exception("The assigned slot " + slot.getSlotId() + " was removed."));
			}

			AllocationID oldAllocationId = slot.getAllocationId();

			if (oldAllocationId != null) {
				fulfilledSlotRequests.remove(oldAllocationId);

				resourceActions.notifyAllocationFailure(
					slot.getJobId(),
					oldAllocationId,
					new FlinkException("The assigned slot " + slot.getSlotId() + " was removed."));
			}
		} else {
			LOG.debug("There was no slot registered with slot id {}.", slotId);
		}
	}
1152493
public static function create(Intent $intent = null): self
    {
        $confirmIntentDirective = new self();

        $confirmIntentDirective->type          = self::TYPE;
        $confirmIntentDirective->updatedIntent = $intent;

        return $confirmIntentDirective;
    }
622113
protected function createSlotManager(Slot $slot)
    {
        $slotName = $slot->getSlotName();
        $blocks = array();
        if (null !== $this->pageBlocks) {
            $blocks = $this->pageBlocks->getSlotBlocks($slotName);
        }
        $slotManager = new SlotManager($slot, $this->blockRepository, $this->blockManagerFactory);
        $slotManager->setUpBlockManagers($blocks);

        return $slotManager;
    }
288502
public function insert($type, $slotname, $page = null)
    {
        if ($page === null || $page === Router::getActivePage()) {
            return $this->edit($type, $slotname, $page);
        }

        return $this->get($type, $slotname, $page);
    }
35170
public function attach($signalIdentifier, Slot $slot)
    {
        if ($signalIdentifier[0] === '\\') {
            $signalIdentifier = substr($signalIdentifier, 1);
        } elseif ($signalIdentifier !== '*') {
            $signalIdentifier = static::RELATIVE_SIGNAL_NAMESPACE . "\\$signalIdentifier";
        }

        $this->signalSlotMap[$signalIdentifier][] = $slot;
    }
1255797
protected function slot_state($tablerow, $slot) {
        $qa = $this->get_question_attempt($tablerow->usageid, $slot);
        $submissionsteps = $qa->get_steps_with_submitted_response_iterator();
        $step = $submissionsteps[$tablerow->try];
        if ($step === null) {
            return null;
        }
        if ($this->is_last_try($tablerow, $slot, $tablerow->try)) {
            // If this is the last try then the step with the try data does not contain the correct state. We need to
            // use the last step's state, after the attempt has been finished.
            return $qa->get_state();
        }
        return $step->get_state();
    }
525651
public function getSlotManager($slotName)
    {
        if ( ! is_string($slotName)) {
            return null;
        }

        return (array_key_exists($slotName, $this->slotManagers)) ? $this->slotManagers[$slotName] : null;
    }
1314193
protected function step_no_for_try($questionusageid, $slot, $tryno) {
        $qa = $this->get_question_attempt($questionusageid, $slot);
        return $qa->get_steps_with_submitted_response_iterator()->step_no_for_try($tryno);
    }
819905
public function repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true) {
        global $DB;
        if (!$quizslots) {
            return null;
        }
        $newslots = array();
        foreach ($quizslots as $slot) {
            if ($type == self::LINK) {
                if ($slot->slot <= $slotfrom) {
                    continue;
                }
                $slot->page = $slot->page - 1;
            } else if ($type == self::UNLINK) {
                if ($slot->slot <= $slotfrom - 1) {
                    continue;
                }
                $slot->page = $slot->page + 1;
            }
            // Update DB.
            if ($dbupdate) {
                $DB->update_record('quiz_slots', $slot);
            }
            $newslots[$slot->id] = $slot;
        }
        return $newslots;
    }
821661
public Slot insertSlotAt(final int position, @NonNull final Slot slot) {

        if (position < 0 || size < position) {
            throw new IndexOutOfBoundsException("New slot position should be inside the slots list. Or on the tail (position = size)");
        }

        final Slot toInsert = new Slot(slot);

        Slot currentSlot = getSlot(position);
        Slot leftNeighbour;
        Slot rightNeighbour = null;
        if (currentSlot == null) {
            // this can happen only when position == size.
            // it means we want to add the slot on the tail
            leftNeighbour = lastSlot;
        } else {
            leftNeighbour = currentSlot.getPrevSlot();
            rightNeighbour = currentSlot;
        }

        toInsert.setNextSlot(rightNeighbour);
        toInsert.setPrevSlot(leftNeighbour);

        if (rightNeighbour != null) {
            // right neighbour is only available for non-last slots
            rightNeighbour.setPrevSlot(toInsert);
        }

        if (leftNeighbour != null) {
            // left neighbour is only available for not-first slots
            leftNeighbour.setNextSlot(toInsert);
        }

        if (position == 0) {
            firstSlot = toInsert;
        } else if (position == size) {
            lastSlot = toInsert;
        }

        size++;

        return toInsert;
    }
1070859
public function is_first_slot_on_page($slotnumber) {
        if ($slotnumber == 1) {
            return true;
        }
        return $this->slotsinorder[$slotnumber]->page != $this->slotsinorder[$slotnumber - 1]->page;
    }
1298502
public final void startActivityForResult(@NonNull final Intent intent, final int requestCode, @Nullable final Bundle options) {
        executeWithRouter(new RouterRequiringFunc() {
            @Override public void execute() { router.startActivityForResult(instanceId, intent, requestCode, options); }
        });
    }
816567
public function redo_question_button($slot, $disabled) {
        $attributes = array('type' => 'submit',  'name' => 'redoslot' . $slot,
                'value' => get_string('redoquestion', 'quiz'), 'class' => 'mod_quiz-redo_question_button');
        if ($disabled) {
            $attributes['disabled'] = 'disabled';
        }
        return html_writer::div(html_writer::empty_tag('input', $attributes));
    }
1070381
public function slot($slot = null)
    {
        if (is_null($slot)) {
            return $this->slot;
        }

        if (! in_array($slot, ['before', 'after'])) {
            throw new InvalidArgumentException(
                "{$slot} is an invalid gate slot"
            );
        }

        $this->slot = $slot;

        return $this;
    }
604885
@Nullable
  public static LocationEngineResult extractResult(Intent intent) {
    LocationEngineResult result = null;
    if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) {
      result = extractGooglePlayResult(intent);
    }
    return result == null ? extractAndroidResult(intent) : result;
  }