/**
  * Isolates a given namespace of annotations.
  *
  * @param \Minime\Annotations\AnnotationsBag $annotations A bag of annotations
  * @param string $prefix namespace
  * @return \Minime\Annotations\AnnotationsBag A bag of annotations
  */
 protected function useNamespace(AnnotationsBag $annotations, $prefix)
 {
     $data = [];
     $consumer = '(' . implode('|', array_map('preg_quote', ['.'])) . ')';
     $namespacePattern = '/^' . preg_quote(rtrim($prefix, '.')) . $consumer . '/';
     foreach ($annotations->toArray() as $key => $value) {
         $newKey = preg_replace($namespacePattern, '', $key);
         if ($newKey === null || $newKey === $key) {
             continue;
         }
         $data[$newKey] = $value;
     }
     return new AnnotationsBag($data);
 }
 /**
  * Retrieves finder information
  *
  * @param Controller $Controller Instance of a controller
  * @param AnnotationsBag $annotations a bag of annotations
  * @return array
  **/
 public function getFinder(Controller $Controller, AnnotationsBag $annotations)
 {
     $tableName = $annotations->get('table');
     $methodName = $annotations->get('method');
     $findMethod = $annotations->get('find');
     $findOptions = $this->useNamespace($annotations, 'options')->toArray();
     if (empty($tableName)) {
         $tableName = $Controller->modelClass;
     }
     return [$tableName, $methodName, $findMethod, $findOptions];
 }