Skip to content

Commit

Permalink
feat: load files with composer
Browse files Browse the repository at this point in the history
  • Loading branch information
devuri committed Jan 17, 2021
1 parent 638a172 commit 68843de
Show file tree
Hide file tree
Showing 9 changed files with 358 additions and 56 deletions.
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
"espresso-dev/instagram-basic-display-php": "^1.1"
},
"autoload": {
"psr-4": {
"SimSocialFeed\\":"src"
}
"psr-4": {
"SimSocialFeed\\":"src"
},
"files": [
"src/schedule.php",
"src/shortcode.php"
]
},
"config": {
"optimize-autoloader": true
Expand Down
6 changes: 5 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions sim-social.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
*/
require_once 'vendor/autoload.php';

// require_once / schedule.
require_once plugin_dir_path( __FILE__ ) . '/src/schedule.php';

// require_once / shortcode.
require_once plugin_dir_path( __FILE__ ) . '/src/shortcode.php';

/**
* Setup some defualts setup activation schedule
*/
Expand Down
228 changes: 228 additions & 0 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
<?php











namespace Composer;

use Composer\Semver\VersionParser;






class InstalledVersions
{
private static $installed = array (
'root' =>
array (
'pretty_version' => '2.7.2.x-dev',
'version' => '2.7.2.9999999-dev',
'aliases' =>
array (
),
'reference' => '638a172c185dac9652568aeb8bf4675aab0fdfd5',
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => '2.7.2.x-dev',
'version' => '2.7.2.9999999-dev',
'aliases' =>
array (
),
'reference' => '638a172c185dac9652568aeb8bf4675aab0fdfd5',
),
'espresso-dev/instagram-basic-display-php' =>
array (
'pretty_version' => 'v1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => '8b9ac7a7bd3dca6c3a31ca66afe5508e0eae9f28',
),
),
);







public static function getInstalledPackages()
{
return array_keys(self::$installed['versions']);
}









public static function isInstalled($packageName)
{
return isset(self::$installed['versions'][$packageName]);
}














public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));

return $provided->matches($constraint);
}










public static function getVersionRanges($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}

$ranges = array();
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
}

return implode(' || ', $ranges);
}





public static function getVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}

if (!isset(self::$installed['versions'][$packageName]['version'])) {
return null;
}

return self::$installed['versions'][$packageName]['version'];
}





public static function getPrettyVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}

if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
return null;
}

return self::$installed['versions'][$packageName]['pretty_version'];
}





public static function getReference($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}

if (!isset(self::$installed['versions'][$packageName]['reference'])) {
return null;
}

return self::$installed['versions'][$packageName]['reference'];
}





public static function getRootPackage()
{
return self::$installed['root'];
}







public static function getRawData()
{
return self::$installed;
}



















public static function reload($data)
{
self::$installed = $data;
}
}
11 changes: 11 additions & 0 deletions vendor/composer/autoload_files.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

// autoload_files.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
'6df4ba8aa0eb44690143d69c920df9e0' => $baseDir . '/src/schedule.php',
'dd9ebc777b0f370dc67051f78ae35b7e' => $baseDir . '/src/shortcode.php',
);
18 changes: 18 additions & 0 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ public static function getLoader()

$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitd7e54b283c57504fcb44f1d17c61f634::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequired7e54b283c57504fcb44f1d17c61f634($fileIdentifier, $file);
}

return $loader;
}
}

function composerRequired7e54b283c57504fcb44f1d17c61f634($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}
5 changes: 5 additions & 0 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

class ComposerStaticInitd7e54b283c57504fcb44f1d17c61f634
{
public static $files = array (
'6df4ba8aa0eb44690143d69c920df9e0' => __DIR__ . '/../..' . '/src/schedule.php',
'dd9ebc777b0f370dc67051f78ae35b7e' => __DIR__ . '/../..' . '/src/shortcode.php',
);

public static $prefixLengthsPsr4 = array (
'S' =>
array (
Expand Down
Loading

0 comments on commit 68843de

Please sign in to comment.