Create rule with one-to-one mapping

@param string $class

@return Rule
769530
public static function createDefault(string $class): Rule
    {
        $rule = new Rule($class);

        $reflection = new \ReflectionClass($class);
        $properties = $reflection->getProperties();

        foreach ($properties as $property) {
            /** @var \ReflectionProperty $property */
            $rule->assign($property->getName(), $property->getName());
        }

        return $rule;
    }
1178657
public function make($class)
    {
        $controller = $this->container->make($class);
        $controller->setServer($this->makeServer());
        $controller->setView($this->makeView());
        $controller->setSession($this->makeSession());
        $controller->setUrlGenerator($this->makeUrlGenerator());

        return $controller;
    }
820690
private function getObjectMapping(string $class): ValidationMappingProviderInterface
    {
        try {
            return $this->validatorObjectMappingRegistry->provideMapping($class);
        } catch (ValidatorLogicException $exception) {
            $this->logger->error('validate: {exception}', ['exception' => $exception->getMessage()]);

            throw $exception;
        }
    }
472186
public function addClass($class)
    {
        $this->setOption(self::OPTION_METHOD, "addClass");
        $this->setOption(self::OPTION_ADD_CLASS, $class);

        return $this;
    }
921233
protected static function loadMappings(/*# string */ $class)
    {
        // mapping status changed ?
        if (self::isStatusUpdated()) {
            self::resetMappings();
            self::setStatus(false);
        }

        // $class' mapping loaded already
        if ($class::hasMappings()) {
            return;
        }

        // load $class mapping
        $loadedClass = $class::hasLoader();
        if ($loadedClass) {
            // loader found
            $class::setMappings(
                $loadedClass::getLoader()->loadMessages($class)
            );
        } else {
            // no loader found
            $class::setMappings([]);
        }
    }
899313
public static function createFromStdClass(stdClass $class)
	{
		$site = isset($class->site) ? $class->site : null;
		$type = isset($class->type) ? $class->type : null;
		$storage_time = isset($class->storage_time) ? $class->storage_time : 0;
		$credits = isset($class->credits) ? $class->credits : 0;
		$soft_quota = isset($class->soft_quota) ? $class->soft_quota : 0;
		$hard_quota = isset($class->hard_quota) ? $class->hard_quota : 0;
		$daily_credits_usage = isset($class->daily_credits_usage) ? $class->daily_credits_usage : 0;
		$unique_hashes = isset($class->unique_hashes) ? $class->unique_hashes : 0;

		return new Status($site, $type, $storage_time, $credits, $soft_quota, $hard_quota, $daily_credits_usage, $unique_hashes);
	}
924419
public function makeInstance($class, $data)
    {
        $class = new \ReflectionClass($class);
        $constructArguments = [];
        if (isset($data['__construct'])) {
            $constructArguments = $this->constructorArgs($data['__construct']);
        }

        return $class->newInstanceArgs($constructArguments);
    }
1177561
public static function getInstance($class)
    {
        $reflection = new ReflectionClass($class);
        $constructor = $reflection->getConstructor();

        if (empty($constructor)) {
            return new $class;
        }

        $parameters = $constructor->getParameters();

        if (empty($parameters)) {
            return new $class;
        }

        $dependencies = array();
        foreach ($parameters as $parameter) {
            $parameter_class = $parameter->getClass();
            $dependencies[] = static::get($parameter_class->getName());
        }

        return $reflection->newInstanceArgs($dependencies);
    }
1090945
private function create_with_args( $class, array $args ) {

		switch ( count( $args ) ) {
			case 0:
				return new $class();
			case 1:
				return new $class( reset( $args ) );
			case 2:
				return new $class( reset( $args ), end( $args ) );
		}

		return ( new \ReflectionClass( $class ) )->newInstanceArgs( $args );
	}
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;
	}
475242
public static function singleton($class = null)
    {
        if (!$class) {
            $class = get_called_class();
        }

        if (!isset(self::$singletons[$class])) {
            self::$singletons[$class] = self::create($class);
        }

        return self::$singletons[$class];
    }
449356
protected function resolve($class)
    {
        if (isset($this->container)) {
            $instance = $this->container->make($class);

            $instance->setContainer($this->container);
        } else {
            $instance = new $class;
        }

        if (isset($this->command)) {
            $instance->setCommand($this->command);
        }

        return $instance;
    }
1196210
public function gateway($class = null)
    {
        $class = $class ?: $this->getDefaultGateway();

        if (!isset($this->gateways[$class])) {
            $gateway = $this->factory->create($class);
            $gateway->initialize($this->getConfig($class));
            $this->gateways[$class] = $gateway;
        }

        return $this->gateways[$class];
    }
106398
public static function fromClass(string $class): self
    {
        /** @var \Colibri\Migration\Migration|string $class */
        $migration             = new self($class);
        $migration->hash       = $class::hash();
        $migration->name       = $class::name();
        $migration->createdAt  = $class::createdAt();
        $migration->migratedAt = $class::migratedAt();

        return $migration;
    }
949825
public function resolveClass(string $class)
    {
        $object = $this->getClass($class);

        $definitions = $this->container->isDefined($object->getName())
            ? $this->container->getDefiniition($object->getName()) : null;

        $constructor_parameters = $object->getConstructor() !== null ? $object->getConstructor()->getParameters() : null;
        $parameters = $this->resolveParameters($constructor_parameters ?? [], $definitions);

        return $object->newInstanceArgs($parameters);
    }
834864
public function setContextualClass($class)
    {
        $class = strtolower($class);
        $this->contextualClass = $class;

        if (property_exists($this, 'contextualClassColorMap')) {
            if (array_key_exists($class, $this->contextualClassColorMap)) {
                $this->setColor(new Color($this->contextualClassColorMap[ $class ]));
            }
        }

        return $this;
    }
464107
public function addClass($class)
    {
        if (!is_array($class)) {
            $class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY);
        }
        $curClass = preg_split('/\s+/', $this->getAttribute('class'),
                               null, PREG_SPLIT_NO_EMPTY);
        foreach ($class as $c) {
            if (!in_array($c, $curClass)) {
                $curClass[] = $c;
            }
        }
        $this->setAttribute('class', implode(' ', $curClass));

        return $this;
    }