Makes and sets instance of the model class and stores it.

@param string $class
@return $this
17923
protected function makeModelInstance($class)
    {
        if ( ! class_exists($class)) {
            throw new UnexpectedValueException("Class '{$class}' does not exist");
        }

        $instance = new $class;

        if ( ! $instance instanceof Model) {
            throw new UnexpectedValueException("Instance of '{$class}' is not a model");
        }

        $this->modelInstance = $instance;

        $this->modelReflection = new ReflectionClass($class);

        return $this;
    }
1362080
public function remove_callable($class)
	{
		if (($key = array_search($class, $this->callables, true)))
		{
			unset($this->callables[$key]);
		}

		return $this;
	}
1057989
public static function instantiateClassByConstructor($class, $args)
    {
        switch (count($args)) {
            case 0:
                return new $class();
            case 1:
                return new $class($args[0]);
            case 2:
                return new $class($args[0], $args[1]);
            case 3:
                return new $class($args[0], $args[1], $args[2]);
            case 4:
                return new $class($args[0], $args[1], $args[2], $args[3]);
            default:
                $rClass = new \ReflectionClass($class);
                return $rClass->newInstanceArgs($args);
        }
    }
400505
public function newInstance($class = null, $options = [])
    {
        if ($class === null) {
            $class = get_class($this);
        } elseif ($class instanceof self) {
            $class = get_class($class);
        }

        if (is_string($class) && $class[0] != '\\') {
            $class = '\\'.$class;
        }

        if ($this->persistence) {
            return $this->persistence->add($class, $options);
        }

        return new $class($options);
    }
497103
private function getModel($class)
    {
        $reflectionClass = new \ReflectionClass($class);
        $instance = $reflectionClass->newInstance();
        if (!($instance instanceof ModelInterface)) {
            throw new \Exception('This class is not supported');
        }

        return $instance;
    }
1210016
public function setClass($id, $class)
    {
        $this->classes[$id] = $class;
        if (isset($this->items[$id])) {
            unset($this->items[$id]);
        }
        $this->allCreated = false;
        return $this;
    }
963752
public function addTableClass($class)
    {
        $class = is_array($class) ? implode(' ', $class) : $class;
        $currentClass = Arr::get(array_change_key_case($this->tableAttributes), 'class');

        $classes = preg_split('#\s+#', $currentClass . ' ' . $class, null, PREG_SPLIT_NO_EMPTY);
        $class = implode(' ', array_unique($classes));

        return $this->setTableAttribute('class', $class);
    }
1232497
public function detachObject($class) {
        if (isset($this->_classes[$class])) {
            unset($this->_classes[$class], $this->_attached[$class], $this->__objectMap[$class]);
        }

        return $this;
    }
1122245
public function removeClass($class): self
    {
        $class = Str::toString($class);

        $classes = array_filter(explode(' ', $class), 'strlen');

        $this->classList->remove(...$classes);

        return $this;
    }
1162203
public function addClass ($class)
    {
        $targetArray = &$this->customClasses;
        if (!is_array($class))
            $targetArray[] = $class;
        else
            $targetArray = array_merge($targetArray, $class);
        return $this;
    }
1194579
public function remove_class( $class ) {
		if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
			$this->_sanitize_class();
		}
		$this->attr['class'] = array_diff( $this->attr['class'], array( $class ) );
		return $this;
	}
107454
public function saveInstance($alias, &$class)
	{
		$alias = strtolower($alias);

		if (array_key_exists($alias, $this->instances))
		{
			unset($this->instances[$alias]);
		}

		$this->instances[$alias] = $class;

		return $this;
	}
211900
public function removeClass($class)
    {
        $index = array_search((string) $class, $this->class);
        if ($index !== false) {
            unset($this->class[$index]);
        }
        return $this;
    }
282574
public static function create($class)
    {
        try {
            $reflection = new \ReflectionClass($class);
        } catch (\ReflectionException $e) {
            return false;
        }

        $constructor = $reflection->getConstructor();

        // If there are no parameters, just return a new object.
        if (null === $constructor) {
            return new $class;
        }

        $newInstanceArgs = self::getMethodArgs($constructor);

        // Create a callable for the dataStorage
        return $reflection->newInstanceArgs($newInstanceArgs);
    }
740696
protected function setClass($class): void
    {
        // @todo fix logic about storing the classname
        $this->className = $class;
        if (is_object($class)) {
            $this->className = get_class($class);
        }
        $this->class = new ReflectionClass($class);
    }
183295
public function setLoggerClass($class)
  {
    $prev = $this->configuration['logger_class'];
    if (!isset($this->configuration['classes'][$class]) &&
        isset($this->configuration['classes'][$prev])) {
      $this->configuration['classes'][$class] =
          $this->configuration['classes'][$prev];
    }
    $this->configuration['logger_class'] = $class;
  }
1081173
public function instantiate( $class ) {
		$this->verifyBootstrap();

		$instance = $this->resolve( $class );

		if ( $instance === null ) {
			if ( ! class_exists( $class ) ) {
				throw new ClassNotFoundException( 'Class not found: ' . $class );
			}

			$instance = new $class();
		}

		return $instance;
	}