public function loadCheck($service_id) { if (empty($this->checks
[$service_id])) { if (!
in_array($service_id,
$this->checkIds
)) { throw new \
InvalidArgumentException(sprintf('No check has been registered for %s',
$service_id));
} $check =
$this->container->
get($service_id);
if (!
($check instanceof AccessInterface
)) { throw new AccessException('All access checks must implement AccessInterface.'
);
} if (!
is_callable([$check,
$this->checkMethods
[$service_id]])) { throw new AccessException(sprintf('Access check method %s in service %s must be callable.',
$this->checkMethods
[$service_id],
$service_id));
} $this->checks
[$service_id] =
$check;
} return [$this->checks
[$service_id],
$this->checkMethods
[$service_id]];
} /**
* Determine which registered access checks apply to a route.
*
* @param \Symfony\Component\Routing\Route $route
* The route to get list of access checks for.
*
* @return array
* An array of service ids for the access checks that apply to passed
* route.
*/