@SuppressWarnings(PHPMD.StaticAccess)

@return \Composer\Json\JsonFile
18820
private function getLockFile()
    {
        $composerFile = \Composer\Factory::getComposerFile();

        $lockFile = 'json' === pathinfo($composerFile, PATHINFO_EXTENSION)
            ? substr($composerFile, 0, -4) . 'lock'
            : $composerFile . '.lock';

        return new \Composer\Json\JsonFile($lockFile, null, $this->appIO);
    }
1278878
public function GetComposer() {

		$filepath = "{$this->ProjectRoot}/composer.json";

		try { $composer = new Nether\Project\Composer($filepath); }
		catch(Exception $e) {
			$this->ShowMessage($e->getMessage());
			exit(0);
		}

		return $composer;
	}
244990
public function toJSON(): string
    {
        $this->internalDataListUpdate();

        // Copied from DataObjectToJSONTrait. Do not modify here !!!
        $toJSON = function($object): string {
            $result = [];

            $vars = get_object_vars($object);
            foreach ($vars as $name => $value) {
                if ($name !== 'internalDataObjectData') {
                    $reflectionProperty = new \ReflectionProperty($object, $name);
                    if ($reflectionProperty->isPublic()) {
                        $result[$name] = null;
                    }
                }
            }
            $propertiesToEncode = [];
            if (isset($object->internalDataObjectData)) {
                foreach ($object->internalDataObjectData as $name => $value) {
                    $result[substr($name, 1)] = null;
                    if (substr($name, 0, 1) === 'p' && isset($value[7])) { // encodeInJSON is set
                        $propertiesToEncode[substr($name, 1)] = true;
                    }
                }
            }
            ksort($result);
            foreach ($result as $name => $null) {
                $value = $object instanceof \ArrayAccess ? $object[$name] : (isset($object->$name) ? $object->$name : null);
                if (method_exists($value, 'toJSON')) {
                    $result[$name] = $value->toJSON();
                } else {
                    if ($value instanceof \DateTime) {
                        $value = $value->format('c');
                    }
                    if (isset($propertiesToEncode[$name]) && $value !== null) {
                        if (is_string($value)) {
                            $value = 'data:;base64,' . base64_encode($value);
                        } else {
                            throw new \Exception('The value of the ' . $name . ' property cannot be JSON encoded. It must be of type string!');
                        }
                    }
                    $result[$name] = json_encode($value);
                    if ($result[$name] === false) {
                        throw new \Exception('Invalid characters in ' . $name . '! Cannot JSON encode the value: ' . print_r($value, true));
                    }
                }
            }
            $json = '';
            foreach ($result as $name => $value) {
                $json .= '"' . addcslashes($name, '"\\') . '":' . $value . ',';
            }
            $json = '{' . rtrim($json, ',') . '}';
            return $json;
        };

        $json = '';
        foreach ($this->internalDataListData as $index => $object) {
            $object = $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, $index);
            if (method_exists($object, 'toJSON')) {
                $json .= $object->toJSON() . ',';
            } else {
                $json .= $toJSON($object) . ',';
            }
        }
        $json = '[' . rtrim($json, ',') . ']';
        return $json;
    }
531871
public function uploadAction ()
    {
        $handle = $this->getRequest()->files->get('file');
        
        if ($handle && $handle->getError()){
            return new JsonResponse(array(
                'success' => false,
                'err_msg' => $this->container->get('translator')
                    ->trans('file_upload_http_error', array(), 'ThraceMediaBundle')
            ));
        }

        $imageManager = $this->container->get('thrace_media.imagemanager');
        $options = $this->container->getParameter('thrace_media.plupload.options');
        $extension = $handle->getClientOriginalExtension();
        $name = uniqid() . '.' . $extension;
        
        if(!$extension){
            return new JsonResponse(array(
                'success' => false,
                'err_msg' => sprintf('Unknown Mime Type: "%s"', $handle->getMimeType())
            ));
        }

        $validate = $this->validateImage($handle);

        if ($validate !== true) {
            return new JsonResponse(array(
                'success' => false,
                'err_msg' => $validate
            ));
        }

        $content = $imageManager->normalizeImage(
            $name, file_get_contents($handle->getRealPath()), 
            $options['normalize_width'], $options['normalize_height']
        );
        
        $imageManager->saveToTemporaryDirectory($name, $content);
        $imageManager->makeImageCopyToOriginalDirectory($name);
        $hash = $imageManager->checksumTemporaryFileByName($name);

        return new JsonResponse(array(
            'success' => true,
            'name'    => $name,
            'hash'    => $hash
        ));
    }
158960
public function json($file = null) : Json
    {
        if ($file === null) {
            $file = 'module.json';
        }

        return array_get($this->moduleJson, $file, function () use ($file) {
            return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->app['files']);
        });
    }
1200668
public function jsonSerialize()
    {
        $data = [
            'url' => $this->url
        ];

        $data = array_merge($data, $this->buildJsonAttributes([
            'certificate' => $this->certificate,
            'max_connections' => $this->maxConnections,
            'allowed_updates' => $this->allowedUpdates
        ]));

        return $data;
    }
17209
public function jsonSerialize()
    {
        $payload = self::getDefaultPayloadStructure();

        if ($this->alert instanceof Alert || is_string($this->alert)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_ALERT_KEY] = $this->alert;
        }

        if (is_int($this->badge)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_BADGE_KEY] = $this->badge;
        }

        if (is_string($this->sound)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_SOUND_KEY] = $this->sound;
        }

        if (is_bool($this->contentAvailable)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_CONTENT_AVAILABLE_KEY] = (int)$this->contentAvailable;
        }

        if (is_bool($this->mutableContent)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_MUTABLE_CONTENT_KEY] = (int)$this->mutableContent;
        }

        if (is_string($this->category)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_CATEGORY_KEY] = $this->category;
        }

        if (is_string($this->threadId)) {
            $payload[self::PAYLOAD_ROOT_KEY][self::PAYLOAD_THREAD_ID_KEY] = $this->threadId;
        }

        if (is_countable($this->customValues) && count($this->customValues)) {
            $payload = array_merge($payload, $this->customValues);
        }

        return $payload;
    }
712258
public function jsonSerialize()
    {
        if (! Norm::options('include')) {
            return $this->toArray();
        }

        $destination = array();
        $source =  $this->toArray();

        $schema = $this->collection->schema();

        foreach ($source as $key => $value) {
            if (isset($schema[$key]) and isset($value)) {
                $destination[$key] = $schema[$key]->toJSON($value);
            } else {
                $destination[$key] = $value;
            }

            $destination[$key] = JsonKit::replaceObject($destination[$key]);
        }

        return $destination;
    }
575969
protected function load_json() {
		$json_file = $this->locate_configuration_file();
		$json_data = '{}';

		if ( '' !== $json_file ) {
			$json_data = file_get_contents( $json_file );
		}

		return $json_data ? $this->parse_json( $json_data ) : array();
	}
35079
public function toJson()
    {
        $json = array();
        $json['id'] = $this->id;
        $json['from'] = $this->from;
        $json['color'] = $this->color;
        $json['message'] = $this->message;
        $json['notify'] = $this->notify;
        $json['message_format'] = $this->messageFormat;
        $json['date'] = $this->date;

        return $json;

    }
681466
public function composerFile(): string
    {
        if (!isset($this->cache[self::COMPOSER_FILE])) {
            $this->cache[self::COMPOSER_FILE] = $this->rootDir() . DIRECTORY_SEPARATOR . 'composer.json';
        }

        return $this->cache[self::COMPOSER_FILE];
    }
720450
public function toJson()
    {
        $response = new Doozr_Base_Response_Rest();
        $response
            ->status(Doozr_Base_Response_Rest::STATUS_ERROR)
            ->message($this->getMessage())
            ->data(array('error' => $this->getError()));

        $data = $response->getData();

        // Check token exchange required then inject
        if ($this->getToken() !== null) {
            $data['security'] = array('token' => $this->getToken());
        }

        // Now here is the interesting part in this logic ...
        if (true === DOOZR_DEBUGGING) {
            // add debug information!
            $data['meta'] = array(
                'message' => $this->getMessage(),
                'code'    => $this->getCode(),
                'file'    => $this->getFile(),
                'line'    => $this->getLine(),
            );
        }

        $response->setData($data);

        return $response->toJson();
    }
885494
public function getJson($jsonFile, $jsonSchema = null)
    {
        if (isset($jsonSchema) && array_key_exists($jsonSchema, $this->validation)) {
            $validation = $this->validation[$jsonSchema];
        } elseif ($jsonSchema === null) {
            $validation = $jsonSchema;
        } else {
            throw new Exception('Invalid jsonSchema validation key');
        }

        try {
            return $this->decodeFile($jsonFile, $validation);
        } catch (\RuntimeException $e) {
            // Runtime errors such as file not found
            $this->errors[] = $e->getMessage();
        } catch (ValidationFailedException $e) {
            // Schema validation errors
            $this->errors[] = $e->getMessage();
        } catch (\Exception $e) {
            // Anything else we did not anticipate
            $this->errors[] = 'Unknown Exception in getPageDefinition()';
            $this->errors[] = $e->getMessage();
        }

        return null;
    }
354445
public function jsonSerialize()
    {
        return array(
            self::METADATA_SOURCE   => $this->metadataSource,
            self::TEMPLATE_VARIABLE => $this->templateVariable,
            self::FILES             => $this->getFiles(),
            self::DIRECTORIES       => $this->directories,
            self::NAME              => $this->name,
            self::ENVIRONNEMENT     => $this->environnement,
            self::DEPENDENCIES      => $this->dependencies,
            self::DTO               => $this->dto,
        );
    }
727160
public function getVersion()
    {
        $composer = $this->loadJsonFileFromRoot("composer.json");

        if (!isset($composer->version)){
            throw new \Exception("composer.json does not contain a version");
        }

        return $composer->version;
    }
943242
public function jsonSerialize()
	{
		// Remove attributes not defined and not required (null)
		$fixedAttributes = $this->getFixedAttributes();
		foreach ($fixedAttributes as $k => $v) {
			if (!in_array($k, $this->requiredAttributes) && is_null($v)) {
				unset($fixedAttributes[$k]);
			}
		}

		// Add "x-" before each key of specification extensions
		$prefixedSpecificationExtensions = [];
		foreach ($this->specificationExtensions as $k => $v) {
			$prefixedSpecificationExtensions['x-' . $k] = $v;
		}

		return array_merge($fixedAttributes, $prefixedSpecificationExtensions);
	}
1194247
public function serializeToJsonString()
    {
        $output = new CodedOutputStream($this->jsonByteSize());
        $this->serializeToJsonStream($output);
        return $output->getData();
    }