コード例 #1
0
ファイル: functions.php プロジェクト: joshdifabio/composed
function package_configs($keys = [], $default = null) : array
{
    /**
     * If $default is not explicitly provided, it should not be passed to Package::getConfig(),
     * hence not simply calling getConfig($keys, $default), as explicitly passing $default = null
     * to getConfig() is different to omitting it
     */
    return packages()->getConfig(...func_get_args());
}
コード例 #2
0
ファイル: getDestinations.php プロジェクト: evantzhao/runaway
    $doc = nearestAirport($query);
    $airportCode = $doc['airport'];
} else {
    $airportCode = $_GET['airport'];
}
if ($airportCode == 'JFK' && !isset($_GET['price'])) {
    echo file_get_contents('./includes/jfk.json');
} else {
    $query = array('Origin' => $airportCode);
    if (isset($_GET['price'])) {
        $query['JetBlue Package Price/Person'] = array('$lt' => floatval($_GET['price']));
    }
    //$cursor = $packages->find($query,array('Destination'=>1,'JetBlue Package Price/Person'=>1,'_id'=>0));
    //$fields=array('Destination'=>1,'JetBlue Package Price/Person'=>1,'_id'=>0);
    $fields = array('Destination' => 1, 'JetBlue Package Price/Person' => 1, '_id' => 0);
    $cursor = packages($query, $fields);
    $destinations = [];
    $destinations['Origin'] = $airportCode;
    foreach ($cursor as $key => $value) {
        if (!isset($destinations[$value['Destination']])) {
            $destinations[$value['Destination']] = $value;
        } else {
            if (floatval($destinations[$value['Destination']]['JetBlue Package Price/Person']) > floatval($value['JetBlue Package Price/Person'])) {
                $destinations[$value['Destination']] = $value;
            }
        }
    }
    foreach ($destinations as $key => $value) {
        if ($key != 'Origin') {
            $destinations[$key]["loc"] = $airportLocations[$value['Destination']];
            $destinations[$key]['airport'] = $destinations[$key]['Destination'];
コード例 #3
0
ファイル: cadenza.php プロジェクト: eridal/cadenza
<?php

$loader = (require 'vendor/autoload.php');
include 'vendor/composer/autoload_classmap.php';
define('FOLDER_CADENZA', $baseDir . '/vendor.src');
emptyFolder(FOLDER_CADENZA);
$packages = packages($loader);
foreach ($packages as $preffix => $paths) {
    $package = package($preffix);
    $folder = FOLDER_CADENZA . "/{$package}";
    if (count($paths) > 1) {
        readfile(__DIR__ . '/message.txt');
        exit;
    }
    $path = $paths[0];
    if (inVendor($path)) {
        createLink($path, $folder);
    }
}
function packages($loader)
{
    $methods = array('getPrefixes', 'getPrefixesPsr4', 'getFallbackDirs', 'getFallbackDirsPsr4', 'getClassMap');
    $result = array();
    foreach ($methods as $method) {
        if ($paths = $loader->{$method}()) {
            $result = array_merge($result, $paths);
        }
    }
    return $result;
}
function package($preffix)