Register classes from a given JSON encoded class definition file.

@param string $filename
969645
public function classesFromFile($filename)
    {
        $classes = $this->loader->load($filename);
        $this->registerClasses($classes);
    }
751207
public function loadJSON(string $JSONfile): void
    {
        $file = new FileManager();
        $this->jsonData = $file->loadLittleFile($JSONfile);
    }
507771
final protected function buildClassNameByFileName($filename)
    {
        $className = sprintf('%s/%s', $this->getNamespace(), $filename);
        // Normalize it
        $className = str_replace(array('//', '/', '\\'), '\\', $className);

        return $className;
    }
1161947
static public function autoload($classname)
    {
        if (strpos($classname, __NAMESPACE__) === 0) {
            $classname = substr($classname, strlen(__NAMESPACE__) + 1);
            if (file_exists(__DIR__ . '/' . str_replace('\\', '/', $classname) . '.php')) {
                require_once __DIR__ . '/' . str_replace('\\', '/', $classname) . '.php';
            }
        }
    }
1242833
public static function restore(string $fileName = self::FILENAME_CONFIG_DEFAULT): ApiContext
    {
        $contextJsonString = self::getContextJsonString($fileName);

        return static::fromJson($contextJsonString);
    }
318991
public function load(string $filename): \Nofuzz\Config\Config
  {
    # Attempt to load config file
    if ( file_exists($filename) ) {
      # Set filename
      $this->filename = $filename;
      # Load the config
      $configArray = json_decode( file_get_contents($filename), true);
      if ($configArray) {
        // $configArray = $this->array_change_key_case_recursive($configArray); // Lowercase the keys
        # Merge the Config with existing config
        // $this->confValues = array_replace_recursive($this->confValues, $configArray);
        $this->confValues = $configArray;
      } else {
        throw new \RunTimeException('Invalid JSON file "'.$filename.'"');

      }
    } else {
      throw new \RunTimeException('Config file "'.$filename.'" not found');

    }

    return $this;
  }
626550
public void registerClass(String name, byte[] bytes) {
	    
		if (registeredClasses.containsKey(name)) {
			throw new IllegalStateException("Attempted to register a class that has been registered already: " + name);
		}
		registeredClasses.put(name, bytes);
	}
132610
public function registerPlugin($className)
    {
        if (!class_exists($className)) {
            throw new \Exception('cannot register unknown class as plugin: '.$className);
        }

        if (!is_subclass_of($className, '\KubernetesController\Plugin\AbstractPlugin')) {
            throw new \Exception('plugin must inherit from \KuberetesController\Plugin\AbstractPlugin: '.$className);
        }

        if (!in_array($className, $this->registeredPlugins)) {
            $this->registeredPlugins[] = $className;
        }
    }
270000
public function load($filename)
    {
        $json = file_get_contents($filename);
        if (false === $json) {
            throw new \RuntimeException("Unable to load file {$filename}");
        } elseif ($json === '') {
            return;
        }

        $data = \GuzzleHttp\json_decode($json, true);
        if (is_array($data)) {
            foreach (json_decode($json, true) as $cookie) {
                $this->setCookie(new SetCookie($cookie));
            }
        } elseif (strlen($data)) {
            throw new \RuntimeException("Invalid cookie file: {$filename}");
        }
    }
902625
public static function set($filename, $data)
    {
        $data = ["_disk_cache" => $data];
        $filename = static::path($filename);
        Json::encodeToFile($filename, $data);
    }
1011660
private function LoadClassesFromJson()
    {
        $classes_def = Json::Decode(
            file_get_contents(
                $this->definitions_path . "classes.json"
            )
        );
        
        $enumerations_def = array();
        
        if(file_exists($this->definitions_path . "class_enumerations.json"))
        {
            $enumerations_def = Json::Decode(
                file_get_contents(
                    $this->definitions_path . "class_enumerations.json"
                )
            );
        }
        
        $variables_def = array();
        
        if(file_exists($this->definitions_path . "class_variables.json"))
        {
            $variables_def = Json::Decode(
                file_get_contents(
                    $this->definitions_path . "class_variables.json"
                )
            );
        }

        foreach($classes_def as $header => $namespaces)
        {
            $this->symbols->AddHeader($header);
            
            foreach($namespaces as $namespace => $classes)
            {
                foreach($classes as $class_name => $methods)
                {   
                    $class = new Element\ClassElement(
                        $class_name
                    );
                    
                    // Set class details
                    if(isset($methods["_description"]))
                    {
                        $class->description = $methods["_description"];
                        unset($methods["_description"]);
                    }
                    
                    if(isset($methods["_parents"]))
                    {
                        $class->AddParents($methods["_parents"]);
                        unset($methods["_parents"]);
                    }
                    
                    if(isset($methods["_struct"]))
                    {
                        $class->struct = true;
                        unset($methods["_struct"]);
                    }
                    
                    if(isset($methods["_forward_declaration"]))
                    {
                        $class->forward_declaration = true;
                        unset($methods["_forward_declaration"]);
                    }
                    
                    if(isset($methods["_platforms"]))
                    {
                        $class->platforms = $methods["_platforms"];
                        unset($methods["_platforms"]);
                    }
                    
                    // Add methods
                    foreach($methods as $method_name => $method_overloads)
                    {
                        $method = new Element\FunctionElement($method_name);
                        
                        foreach($method_overloads as $method_overload)
                        {
                            $overload = new Element\Overload(
                                $method_overload["description"]
                            );

                            $overload->SetReturnType(
                                new Element\ReturnType(
                                    $method_overload["return_type"]
                                )
                            );
                            
                            if(isset($method_overload["constant"]))
                                $overload->constant = $method_overload["constant"];

                            if(isset($method_overload["static"]))
                                $overload->static = $method_overload["static"];

                            if(isset($method_overload["virtual"]))
                                $overload->virtual = $method_overload["virtual"];

                            if(isset($method_overload["pure_virtual"]))
                                $overload->pure_virtual = $method_overload["pure_virtual"];

                            if(isset($method_overload["protected"]))
                                $overload->protected = $method_overload["protected"];

                            if(isset($method_overload["parameters"]))
                            {
                                foreach($method_overload["parameters"] as $parameter)
                                {
                                    if(!isset($parameter["value"]))
                                        $parameter["value"] = "";
                                    
                                    if(!isset($parameter["description"]))
                                        $parameter["description"] = "";

                                    $param = new Element\Parameter(
                                        $parameter["name"], 
                                        $parameter["type"], 
                                        $parameter["value"],
                                        $parameter["description"]
                                    );

                                    if(isset($parameter["is_array"]))
                                    {
                                        $param->is_array = true;
                                    }

                                    $overload->AddParameter($param);
                                }
                            }

                            $method->AddOverload($overload);
                        }
                        
                        $class->AddMethod($method);
                    }
                    
                    // Add enumerations
                    if(isset($enumerations_def[$header][$namespace][$class_name]))
                    {
                        foreach($enumerations_def[$header][$namespace][$class_name] as $enumeration_name=>$enumeration_data)
                        {
                            if(!isset($enumeration_data["description"]))
                                $enumeration_data["description"] = "";
                            
                            $class->AddEnumeration(
                                new Element\Enumeration(
                                    $enumeration_name,
                                    $enumeration_data["options"],
                                    $enumeration_data["description"]
                                )
                            );
                        }
                    }
                    
                    // Add variables
                    if(isset($variables_def[$header][$namespace][$class_name]))
                    {
                        foreach($variables_def[$header][$namespace][$class_name] as $variable_name=>$variable_options)
                        {
                            $variable = new Element\ClassVariable(
                                $variable_name, 
                                $variable_options["type"]
                            );
                            
                            if(isset($variable_options["static"]))
                                $variable->static = $variable_options["static"];

                            if(isset($variable_options["mutable"]))
                                $variable->mutable = $variable_options["mutable"];

                            if(isset($variable_options["protected"]))
                                $variable->protected = $variable_options["protected"];

                            if(isset($variable_options["public"]))
                                $variable->public = $variable_options["public"];
                            
                            if(isset($variable_options["description"]))
                                $variable->description = $variable_options["description"];
                            
                            $class->AddVariable($variable);
                        }
                    }
                    
                    $this->symbols->headers[$header]->AddClass(
                        $class,
                        $namespace
                    );
                }
            }
        }

        unset($classes_def);
        unset($enumerations_def);
        unset($variables_def);
    }
1078853
public function instance($classname)
    {
        // Find the class instance, and register the class if the instance is not found.
        if(!($instance = jaxon()->getPluginManager()->getRegisteredObject($classname)))
        {
            $instance = jaxon()->registerClass($classname, [], true);
        }
        if(($instance))
        {
            $this->initInstance($instance);
        }
        return $instance;
    }
1135914
protected function setFilenameOption($filename): void
    {
        if (is_string($filename)) {
            $filename = new BasicFilename($filename);
        }

        if (!is_callable($filename)) {
            throw new TypeError("Filename should be a string or callable");
        }

        $this->filename = $filename;
    }
772055
public function load($className) {
        if (class_exists($className, FALSE) || interface_exists($className, FALSE)) {
            return;
        }

        foreach ($this->dirs as $dir) {
            if ($this->loadClass($this->basePath . DIRECTORY_SEPARATOR . $dir, $className)) {
                return;
            }
    	}
    }
77218
def register_json():
    """"""
    from anyjson import serialize as json_serialize
    from anyjson import deserialize as json_deserialize

    registry.register('json', json_serialize, json_deserialize,
                      content_type='application/json',
                      content_encoding='utf-8')
412368
protected static function loadJson( $fileName )
	{
		$json	= FS_File_Reader::load( $fileName );
		$json	= ADT_JSON_Converter::convertToArray( $json );
		foreach( $json as $sectionName => $sectionData )
		{
			foreach( $sectionData as $pairKey => $pairData )
			{
				$pairData	= array_merge( array( 'key' => $pairKey ), $pairData );
				$data[$sectionName][]	= $pairData;
			}
		}
		return $data;
	}
1362664
public function loadJson($filename)
  {
    $result = false;
    if (file_exists($filename) && is_file($filename)) {
      $json = file_get_contents($filename);
      $data = json_decode($json, true);
      if (is_array($data)) {
        foreach ($data as $name => $value) {
          $this->__set($name, $value);
        }
        $result = true;
      }
    }
    return $result;
  }