Parses and resolves the json schema source and returns the object
presentation of the schema

@param string $source
@return string
193151
public function parse($source)
    {
        $resolver = new RefResolver();

        if ($this->connection !== null) {
            $resolver->addResolver('schema', new Resolver($this->connection));
        }

        $parser = new JsonSchema(null, $resolver);
        $schema = $parser->parse($source);

        return Service\Schema::serializeCache($schema);
    }
1148561
protected function getListMap($source)
    {
        // Extract Map from ID / Text Fields:
        
        if ($source instanceof SS_List) {
            $source = $source->map($this->getIDField(), $this->getTextField());
        }
        
        // Convert Map to Array:
        
        if ($source instanceof Map) {
            $source = $source->toArray();
        }
        
        // Determine Invalid Types:
        
        if (!is_array($source) && !($source instanceof ArrayAccess)) {
            user_error('$source passed in as invalid type', E_USER_ERROR);
        }
        
        // Answer Data Source:
        
        return $source;
    }
236081
protected function findByFilterComponentsSourceSetup( $source )
    {

        // Set source defaults
        if( !( $source & ( self::PERSISTED | self::UNPERSISTED ) ) ) {
            $source += self::PERSISTED + self::UNPERSISTED;
        }

        if( !( $source & ( self::CHANGED | self::UNCHANGED ) ) ) {
            $source += self::CHANGED + self::UNCHANGED;
        }

        if( !( $source & ( self::WITH_CHILDREN | self::NO_CHILDREN ) ) ) {
            $source += self::WITH_CHILDREN;
        }

        if( !( $source & ( Base::DATA | Base::INITIAL ) ) ) {
            $source += Base::DATA;
        }

        return $source;

    }
1127207
public function convert($source)
    {
        $xpath = new \DOMXPath($source);

        $defaultConfig = $this->getDefaultConfiguration($xpath);
        $configuration = ['default' => $defaultConfig];

        foreach ($this->getAllLanguages($xpath) as $language) {
            $configuration[$language] = $this->getLanguageConfiguration($xpath, $language, $defaultConfig);
        }

        return $configuration;
    }
706925
public function getSourceChildPropertiesToBeConverted($source)
    {
        if (is_string($source)) {
            return [];
        }
        if (isset($source['__identity'])) {
            unset($source['__identity']);
        }
        return parent::getSourceChildPropertiesToBeConverted($source);
    }
433694
public static function fromPattern($source) {
        $source = preg_replace('/([\[\]\(\)\|]|\.\.\.)/', ' $1 ', $source);
        $source = preg_split('/\s+|(\S*<.*?'.'>)/', $source, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        return new static($source, DocoptFormatError::class);
    }
961244
protected function _decode($source)
    {
        // entity decode
        $trans_tbl = get_html_translation_table(HTML_ENTITIES);
        foreach ($trans_tbl as $k => $v) {
            $ttr[$v] = utf8_encode($k);
        }
        $source = strtr($source, $ttr);

        // convert decimal
        //$source = preg_replace('/&#(\d+);/me', "chr(\\1)", $source); // decimal notation
        $source = preg_replace_callback(
                       '/&#(\d+);/m',
                       function ($m) {
                           return chr($m[1]);
                       },
                       $source
        );

        // convert hex
        //$source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source); // hex notation
        
        $source = preg_replace_callback(
                       '/&#x([a-f0-9]+);/mi',
                       function ($m) {
                           return chr('0x'.$m[1]);
                       },
                       $source
        );
        
        return $source;
    }
548134
protected function findDataSource($source)
    {
        foreach ($this->dataSources as $dataSource) {
            if ($dataSource->supports($source)) {
                return $dataSource;
            }
        }

        throw new \RuntimeException('Unknown source type');
    }
147537
public function formatSource($source)
    {
        if (! is_object($source)) {
            return '';
        }

        $parts = [];

        if ($source->namespace) {
            $parts['namespace'] = $source->namespace . '::';
        }

        $parts['name'] = $source->name;
        $parts['line'] = ':' . $source->line;

        return implode($parts);
    }
273238
protected function _decode($source)
    {
        // entity decode
        $ttr       = array();
        $trans_tbl = get_html_translation_table(HTML_ENTITIES);
        foreach($trans_tbl as $k => $v) {
            $ttr[$v] = utf8_encode($k);
        }
        $source = strtr($source, $ttr);

        // convert decimal
        $source = preg_replace('/&#(\d+);/me', "chr(\\1)", $source); // decimal notation

        // convert hex
        $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source); // hex notation
        return $source;
    }
1088295
public static function getJsonSchema($deprecated=null)
    {
        $class = get_called_class();

        /**
         * Look in local cache
         */
        if (array_key_exists($class, self::$jsonSchema)) {
            return self::$jsonSchema[$class];
        }

        /**
         * If not in local cache, we ask to the adaptor
         */
        $adapter = StoreManager::getAdapter($class);
        if ($adapter && ($adapter instanceof CachedJsonSchemaInterface )) {
            $schema = $adapter->getJsonSchema($class);
            if ($schema) {
                if (!array_key_exists($class, self::$jsonSchema)) {
                    self::$jsonSchema[$class] = $schema;
                }

                return $schema;
            }
        }

        $annotationReader = StoreManager::getAnnotationReader();
        $definition = array();

        $reflect = new \ReflectionClass($class);
        $props = $reflect->getProperties(\ReflectionProperty::IS_PROTECTED);

        foreach ($props as $prop) {
            $property = $prop->getName();
            $annotations = $annotationReader->getPropertyAnnotations($prop);
            $definition[$property]  = array();
            $definition[$property]['storeClasses'] = array();
            $definition[$property]['allowedId'] = array();
            $definition[$property]['validationConstraints'] = array();

            foreach ($annotations as $annotation) {
                if ($annotation instanceof Store\Property) {
                    $definition[$property]['description'] = $annotation->description;
                    $definition[$property]['keepIfNull'] = $annotation->keepIfNull;
                    $definition[$property]['private'] = $annotation->private;

                    if (substr($property,0,1) == "_") {
                        $definition[$property]['internal'] = true;
                    } else {
                        $definition[$property]['internal'] = false;
                    }

                    $definition[$property]['alias'] = $annotation->alias;
                    $definition[$property]['recommended'] = $annotation->recommended;
                } elseif ($annotation instanceof Store\StoreClass) {
                    $definition[$property]['storeClasses'] = (array) $annotation->value;
                } elseif ($annotation instanceof Assert\Type) {
                    $definition[$property]['type'] = $annotation->type;
                } elseif ($annotation instanceof Constraint) {
                    $definition[$property]['validationConstraints'][] = static::getClassName($annotation);
                } elseif ($annotation instanceof Store\AllowedId) {
                    $definition[$property]['allowedId'] = (array) $annotation->value;
                }

                if ($adapter) {
                    $newDef = $adapter->extendStoreSchema($annotation, $property, $definition);
                    if (is_array($newDef)) {
                        $definition[$property] = array_merge($newDef, $definition[$property]);
                    }
                }
            }
        }

        /**
         * Check the schema integrity.
         * When close to relase, should move this to a store
         */
        $error = StoreException::STORE_003;
        foreach ($definition as $prop => $propertyDefinition) {
            //Remove added properties that are not store property.
            if (!isset($propertyDefinition['description'])) {
                unset($definition[$prop]);
                continue;
            }

            if (!isset($propertyDefinition['type']))
                //throw new \Exception ("$class->$prop must have Assert\Type(\"type\") defined.");
                throw new StoreException("$class->$prop must have Assert\Type(\"type\") defined.", $error);
            if (!$propertyDefinition['type'])
                throw new StoreException("$class->$prop must have Assert\Type(\"type\") defined.", $error);
        }

        self::$jsonSchema[$class] = array();
        self::$jsonSchema[$class]['definition'] = $definition;
        self::$jsonSchema[$class]['configuration'] = array();
        self::$jsonSchema[$class]['configuration']['_className'] = $class;

        if ($adapter && $adapter instanceof CachedJsonSchemaInterface) {
            $adapter->cacheJsonSchema($class, self::$jsonSchema[$class]);
        }

        return self::$jsonSchema[$class];
    }
390447
protected static function _decode($source)
	{
		static $ttr;

		if (!is_array($ttr))
		{
			// Entity decode
			$trans_tbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT);

			foreach ($trans_tbl as $k => $v)
			{
				$ttr[$v] = utf8_encode($k);
			}
		}

		$source = strtr($source, $ttr);

		// Convert decimal
		$source = preg_replace_callback(
			'/&#(\d+);/m',
			function ($matches)
			{
				return utf8_encode(chr($matches[1]));
			},
			$source
		);

		// Convert hex
		$source = preg_replace_callback(
			'/&#x([a-f0-9]+);/mi',
			function ($matches)
			{
				return utf8_encode(chr('0x' . $matches[1]));
			},
			$source
		);

		return $source;
	}
121758
public function get($source)
    {
        $path = realpath($source);
        $path = (is_null($path)) ? '' : $path;

        $result = $this->sources->get($path);

        if ($result->isEmpty()) {
            return null;
        }

        return $result->get();
    }
694411
public function load($source)
    {
        if (isset($this->_messages[$source])) {
            return $this->_messages[$source];
        } else {
            $filename_cordillera = CORDILLERA_DIR.'languages'.DS.$this->language.DS.$source.'.php';
            $filename_app = CORDILLERA_APP_DIR.'languages'.DS.$this->language.DS.$source.'.php';

            $this->_messages[$source] = is_file($filename_app) ?
                require_once $filename_app : (is_file($filename_cordillera) ? require_once $filename_cordillera : []);
        }

        return $this->_messages[$source];
    }
369453
function(source) {
    if (typeof source === 'object') {
      this.ast = source;
    }
    else if (typeof source === 'string') {
      // JSON source:
      if (isJSON(source)) {
        this.ast = JSON.parse(source);
      }
      // Sass source:
      else {
        this.ast = gonzales.parse(source, {syntax: 'scss'});
      }
    }
    else {
      throw 'Source could not be loaded.';
    }

    return this.resetMapping();
  }
1220837
public function getPaths($source)
    {
        $source = $this->cleanSource($source);
        list(, $paths) = $this->parse($source);

        return $paths;
    }
158471
public function getSourceChildPropertiesToBeConverted($source) {
		if (is_string($source)) {
			$source = [
				'payload' => [
					'__identity' => $source,
				]
			];
		} elseif (isset($source['__identity'])) {
			$source['payload'] = [
				'__identity' => $source['__identity'],
			];
			unset($source['__identity']);
		} elseif (!isset($source['payload'])) {
			$source['payload'] = [];
		}
		$source = parent::getSourceChildPropertiesToBeConverted($source);
		return $source;
	}