public function scan($entity) { $scanner = new \Mocker\Scanner(); $contexts = $scanner->scan($entity); if (count($contexts) > 1) { throw new Exception\MoreThanOneException(400, 'Scanner return more than one context'); } $this->setContext($contexts[0]); if (empty($this->context->getEntity())) { throw new \Exception('Entity is required in context to create a mock'); } if (empty($this->context->getProperties())) { throw new \Exception('Propety is required in context to create a mock'); } }