original_string: public function assemble($document, Schema $schema)
      {
          $entityClass = $schema->entityClass;
          $model = Ioc::make($entityClass);
  
          foreach ($document as $field => $value) {
              $fieldType = $schema->fields[$field] ?? null;
  
              if ($fieldType && 'schema.' == substr($fieldType, 0, 7)) {
                  $value = $this->assembleDocumentsRecursively($value, substr($fieldType, 7));
              }
  
              $model->$field = $value;
          }
  
          $entity = $this->morphingTime($model);
  
          return $this->prepareOriginalAttributes($entity);
      }
code: public function assemble($document, Schema $schema)
      {
          $entityClass = $schema->entityClass;
          $model = Ioc::make($entityClass);
  
          foreach ($document as $field => $value) {
              $fieldType = $schema->fields[$field] ?? null;
  
              if ($fieldType && 'schema.' == substr($fieldType, 0, 7)) {
                  $value = $this->assembleDocumentsRecursively($value, substr($fieldType, 7));
              }
  
              $model->$field = $value;
          }
  
          $entity = $this->morphingTime($model);
  
          return $this->prepareOriginalAttributes($entity);
      }
code_tokens: public function assemble ( $ document , Schema $ schema ) { $ entityClass = $ schema -> entityClass ; $ model = Ioc :: make ( $ entityClass ) ; foreach ( $ document as $ field => $ value ) { $ fieldType = $ schema -> fields [ $ field ] ?? null ; if ( $ fieldType && 'schema.' == substr ( $ fieldType , 0 , 7 ) ) { $ value = $ this -> assembleDocumentsRecursively ( $ value , substr ( $ fieldType , 7 ) ) ; } $ model -> $ field = $ value ; } $ entity = $ this -> morphingTime ( $ model ) ; return $ this -> prepareOriginalAttributes ( $ entity ) ; }
docstring: Builds an object from the provided data.
  
  @param array|object $document the attributes that will be used to compose the entity
  @param Schema       $schema   schema that will be used to map each field
  
  @return mixed
docstring_tokens: Builds an object from the provided data .