/**
  * Get/set the controller this authorize object will be working with. Also checks that isAuthorized is implemented.
  *
  * @param Controller $controller null to get, a controller to set.
  * @return mixed
  * @throws \Cake\Error\Exception
  */
 public function controller(Controller $controller = null)
 {
     if ($controller) {
         if (!method_exists($controller, 'isAuthorized')) {
             throw new Error\Exception(sprintf('%s does not implement an isAuthorized() method.', get_class($controller)));
         }
     }
     return parent::controller($controller);
 }
 /**
  * Sets up additional actionMap values that match the configured `Routing.prefixes`.
  *
  * @param ComponentRegistry $registry The component registry from the controller.
  * @param array $config An array of config. This class does not use any config.
  */
 public function __construct(ComponentRegistry $registry, $config = array())
 {
     parent::__construct($registry, $config);
     $this->_setPrefixMappings();
 }