@param array $class_setting
@param string $instanceof

@return bool|Singleton
431860
protected function get_class_instance( $class_setting, $instanceof ) {
		if ( false !== $class_setting && class_exists( $class_setting[0] ) && is_subclass_of( $class_setting[0], '\Technote\Interfaces\Singleton' ) ) {
			try {
				/** @var Singleton[] $class_setting */
				$instance = $class_setting[0]::get_instance( $this->app );
				if ( $instance instanceof $instanceof ) {
					if ( $instance instanceof \Technote\Interfaces\Controller\Admin ) {
						$instance->set_relative_namespace( $class_setting[1] );
					}

					return $instance;
				}
			} catch ( \Exception $e ) {
			}
		}

		return false;
	}
891798
public static function isClass($class_name) {
    $class_names = func_get_args();

    return function ($node) use ($class_names) {
      if ($node instanceof ClassNode) {
        return in_array($node->getName()->getText(), $class_names, TRUE);
      }
      return FALSE;
    };
  }
292643
public function findInstances($instanceType) {
		
		$instancesArray = array();

		$reflectionInstanceType = new \ReflectionClass($instanceType);
		$isInterface = $reflectionInstanceType->isInterface();

		foreach ($this->declaredInstances as $instanceName=>$classDesc) {
			if (!isset($classDesc['class'])) {
				continue;			
			}
			$className = $classDesc['class'];
			
			// Silently ignore any non existing class.
			if (!class_exists($className)) {
				continue;
			}
			
			
			$reflectionClass = new \ReflectionClass($className);
			if ($isInterface) {
				if ($reflectionClass->implementsInterface($instanceType)) {
					$instancesArray[] = $instanceName;
				}
			} else {
				if ($reflectionClass->isSubclassOf($instanceType) || $reflectionClass->getName() == $instanceType) {
					$instancesArray[] = $instanceName;
				}
			}
		}
		return $instancesArray;
	}
1327223
static function GetInstance()
	{
		if (!self::$IS_INITIALIZED) self::Init();

		if (!self::$INSTANCE instanceof self) self::$INSTANCE = new self;

		return self::$INSTANCE;
	}
1294183
protected static function getCachedInstance()
    {
        $class = get_called_class();
        if (self::$instances === null || !isset(self::$instances[$class])) {
            return null;
        }
        return self::$instances[$class];
    }
538580
private static function initInstance(): Instance
    {
        $instance = new Instance();
        if ($data = Config::get('registry')) {
            $instance->setFromArray($data);
        }
        return $instance;
    }
731899
public function newInstance2($selfedit = "false", $instanceName=null, $instanceClass=null) {
        $this->instanceName = $instanceName;
        $this->instanceClass = $instanceClass;
        $this->selfedit = $selfedit;

        $this->contentBlock->addFile(dirname(__FILE__)."/../../views/instances/newInstance.php", $this);
        $this->template->toHtml();
    }
356029
public static function singleton()
    {
        $returnValue = null;

        
        
        if(is_null(self::$instance)){
        	$class = __CLASS__;				//used in case of subclassing
        	self::$instance = new $class();
        }
        $returnValue = self::$instance;
        
        

        return $returnValue;
    }
824840
public static function instance($model_class)
	{
		$observer = get_called_class();
		if (empty(static::$_instances[$observer][$model_class]))
		{
			static::$_instances[$observer][$model_class] = new static($model_class);
		}

		return static::$_instances[$observer][$model_class];
	}
1119109
public function getInstanceType($instanceName) {
		if (isset($this->declaredInstances[$instanceName]['class'])) {
			return $this->declaredInstances[$instanceName]['class'];
		} else {
			return null;
		}
	}
1005890
public function newInstance($selfedit = "false", $instanceName=null, $instanceClass=null) {
        //$componentsList = Moufspector::getComponentsList();
        $this->selfedit = $selfedit;
        $componentsList = MoufReflectionProxy::getComponentsList($selfedit=="true");
        sort($componentsList);

        $template = $this->template;
        $template->addContentFunction(array($this, "displayNewInstanceScreen"), $componentsList, $selfedit, $instanceName, $instanceClass);
        //$template->addContentFile(dirname(__FILE__)."/../views/displayNewInstance.php", $this);
        $template->toHtml();
    }
620506
public static function & GetInstance () {
		// get `"ClassName"` string from this call: `ClassName::GetInstance();`
		$staticClassName = version_compare(PHP_VERSION, '5.5', '>') ? static::class : get_called_class();
		$args = func_get_args();
		$instanceIndex = str_replace('\\', '_', $staticClassName) . '#' . serialize($args);
		if (!isset(self::$instances[$instanceIndex])) {
			$reflectionClass = new \ReflectionClass($staticClassName);
			$instance = $reflectionClass->newInstanceArgs($args);
			self::$instances[$instanceIndex] = $instance;
		}
		return self::$instances[$instanceIndex];
	}
315902
public static function get_instance_info($instanceid) {
        global $DB;

        $params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid));
        $warnings = array();

        // Retrieve guest enrolment plugin.
        $enrolplugin = enrol_get_plugin('guest');
        if (empty($enrolplugin)) {
            throw new moodle_exception('invaliddata', 'error');
        }

        self::validate_context(context_system::instance());
        $enrolinstance = $DB->get_record('enrol', array('id' => $params['instanceid']), '*', MUST_EXIST);

        $course = $DB->get_record('course', array('id' => $enrolinstance->courseid), '*', MUST_EXIST);
        if (!core_course_category::can_view_course_info($course) && !can_access_course($course)) {
            throw new moodle_exception('coursehidden');
        }

        $instanceinfo = $enrolplugin->get_enrol_info($enrolinstance);
        // Specific instance information.
        $instanceinfo->passwordrequired = $instanceinfo->requiredparam->passwordrequired;

        unset($instanceinfo->requiredparam);

        $result = array();
        $result['instanceinfo'] = $instanceinfo;
        $result['warnings'] = $warnings;
        return $result;
    }
753371
public static function isClassInstance($object, $class_name)
    {
        if (class_exists($class_name) && is_object($object)) {
            return (bool) ($object instanceof $class_name);
        }
        return false;
    }
541549
static function instance( $module_id, $module_type, $module_unique_affix ) {
			$key = 'm_' . $module_id;

			if ( ! isset( self::$_instances[ $key ] ) ) {
				self::$_instances[ $key ] = new FS_Admin_Menu_Manager( $module_id, $module_type, $module_unique_affix );
			}

			return self::$_instances[ $key ];
		}
1136447
private function selectChildSettingsAmongTwo(
        SettingsInterface $instance1,
        SettingsInterface $instance2
    ): ?SettingsInterface {
        return is_subclass_of($instance1, get_class($instance2)) === true ?
            $instance1 : (is_subclass_of($instance2, get_class($instance1)) === true ? $instance2 : null);
    }
457685
public static function checkConfig(&$config, $instanceOf = null, $removeClass = true)
    {
        // Get class from config
        $class = static::getClassFromConfig($config, $removeClass);

        // Make sure we have a valid class
        if ($instanceOf && !is_subclass_of($class, $instanceOf)) {
            static::throwInvalidInstanceException($class, $instanceOf);
        }

        return $class;
    }