creates from a stdClass

@param stdClass $class

@return \DoubleOptIn\ClientApi\Client\Commands\Responses\Models\Action
423517
public static function createFromStdClass(stdClass $class)
	{
		$hash = isset($class->hash) ? $class->hash : null;
		$scope = isset($class->scope) ? $class->scope : null;
		$action = isset($class->action) ? $class->action : null;
		$data = isset($class->data) ? $class->data : null;
		$state = isset($class->state) ? $class->state : null;
		$ip = isset($class->ip) ? $class->ip : null;
		$useragent = isset($class->useragent) ? $class->useragent : null;
		$createdAt = isset($class->created_at) ? $class->created_at : null;

		return new Action($hash, $scope, $action, $data, $state, $ip, $useragent, $createdAt);
	}
671268
protected function createMigration($class)
    {
        // since Yii 2.0.12 includeMigrationFile() exists, which replaced the code below
        // remove this construct when composer requirement raises above 2.0.12
        if (method_exists($this, 'includeMigrationFile')) {
            $this->includeMigrationFile($class);
        } else {
            $class = trim($class, '\\');
            if (strpos($class, '\\') === false) {
                $file = $this->migrationPath . DIRECTORY_SEPARATOR . $class . '.php';
                require_once($file);
            }
        }

        return new $class(['db' => $this->db, 'compact' => isset($this->compact) ? $this->compact : false]);
    }
940143
public function on($class)
    {
        $this->instance = is_string($class) ? $this->container !== null ? $this->container->make($class) : new $class : $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;
	}
718019
public function importFromStdClass($stdClass)
    {
        $reflect = new ReflectionClass(get_called_class());
        $properties = $reflect->getDefaultProperties();
        foreach ($properties as $key => $value) {
            $this->{$key} = $stdClass->{$key};
        }
    }
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;
    }
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);
    }
1246700
public static function createClass(
            $class,
            $data
            )
    {
        if (!class_exists($class)) {
            return null;
        }
        $ref = new \ReflectionClass($class);
        if ($ref->isAbstract()) {
            return null;
        }
        $store =  new $class($data);

        return $store;
    }
658168
public function get($class)
    {
        $pool = $this->map[$class]??null;
        if ($pool == null) {
            $pool = $this->applyNewPool($class);
        }
        if (!$pool->isEmpty()) {
            return $pool->shift();
        } else {
            $this->addNewCount($class);
            return new $class;
        }
    }
571168
private function newInstance($class)
    {
        $entity = $class->newInstance();

        if ($entity instanceof \Doctrine\Common\Persistence\ObjectManagerAware) {
            $entity->injectObjectManager($this->em, $class);
        }

        return $entity;
    }
1335516
protected function instantiator(string $class): InstantiatorInterface
    {
        if (isset($this->instantiators[$class])) {
            return $this->instantiators[$class];
        }

        //Potential optimization
        $instantiator = $this->getFactory()->make(
            $this->define($class, self::D_INSTANTIATOR),
            [
                'class'  => $class,
                'odm'    => $this,
                'schema' => $this->define($class, self::D_SCHEMA)
            ]
        );

        //Constructing instantiator and storing it in cache
        return $this->instantiators[$class] = $instantiator;
    }
407587
protected static function makeInstance(
        $class, array $options = null
    ): Implementation {

        $options || $options = ['provider' => self::app()];

        return IOC::make($class, [$options, true]);
    }
141023
public function getNewInstance($class) {
		if (isset($this->aliases[$class])) {
			$class = $this->aliases[$class];
		}

		$args = $this->resolveArgs($class, '__construct', " when constructing $class");
		if ($args) {
			$instance = new $class(...$args);
		} else {
			$instance = new $class;
		}

		return $instance;
	}
735082
public function fetchFirstObj(string $class = null)
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        $data = $this->fetchFirst();

        if ($data === null) {
            return null;
        }

        if ($class == null) {
            $obj = new \stdClass();

            foreach ($data as $field => $value) {
                $obj->$field = $value;
            }

            return $obj;
        } else {
            return new $class($data);
        }
    }
157123
public static function create($class, $name)
    {
        $actor = Pool::getInstance()->get($class);
        $actor->initialization($name);
        return $actor;
    }
1115378
private function getService($class)
    {
        if (!array_key_exists($class, $this->services)) {
            $this->services[$class] = new $class($this->getClient(), $this->getLogger());
        }

        return $this->services[$class];
    }
617612
private static function createObject($data, $class)
    {
        if (!class_exists($class)) {
            throw new \UnexpectedValueException(sprintf('Class %s does not exist.', $class));
        }

        if (!is_subclass_of($class, AbstractResult::class)) {
            throw new \UnexpectedValueException(
                sprintf('Result class %s must extend %s.', $class, AbstractResult::class)
            );
        }

        foreach ($class::getMap() as $property => $propertyClass) {
            if (isset($data[$property])) {
                $data[$property] = self::create($data[$property], $propertyClass);
            }
        }

        return new $class($data);
    }