original_string: protected function embedsOne(string $entity, string $field)
      {
          if (is_subclass_of($entity, Schema::class)) {
              $entity = (new $entity())->entityClass;
          }
  
          $items = (array) $this->$field;
          if (false === empty($items) && false === array_key_exists(0, $items)) {
              $items = [$items];
          }
  
          return Ioc::make(CursorFactory::class)
              ->createEmbeddedCursor($entity, $items)->first();
      }
code: protected function embedsOne(string $entity, string $field)
      {
          if (is_subclass_of($entity, Schema::class)) {
              $entity = (new $entity())->entityClass;
          }
  
          $items = (array) $this->$field;
          if (false === empty($items) && false === array_key_exists(0, $items)) {
              $items = [$items];
          }
  
          return Ioc::make(CursorFactory::class)
              ->createEmbeddedCursor($entity, $items)->first();
      }
code_tokens: protected function embedsOne ( string $ entity , string $ field ) { if ( is_subclass_of ( $ entity , Schema :: class ) ) { $ entity = ( new $ entity ( ) ) -> entityClass ; } $ items = ( array ) $ this -> $ field ; if ( false === empty ( $ items ) && false === array_key_exists ( 0 , $ items ) ) { $ items = [ $ items ] ; } return Ioc :: make ( CursorFactory :: class ) -> createEmbeddedCursor ( $ entity , $ items ) -> first ( ) ; }
docstring: Return a embedded documents as object.
  
  @param string $entity class of the entity or of the schema of the entity
  @param string $field  field where the embedded document is stored
  
  @return Model|null
docstring_tokens: Return a embedded documents as object .