forked from silexlabs/amfphp-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
57 lines (45 loc) · 1.59 KB
/
index.php
File metadata and controls
57 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* This file is part of amfPHP
*
* LICENSE
*
* This source file is subject to the license that is bundled
* with this package in the file license.txt.
* @package Amfphp
*/
/**
* includes
* */
require_once dirname(__FILE__) . '/Amfphp/ClassLoader.php';
Configuration::set("DOCTRINE_DEFAULT_HYDRATION", Aerial_Core::HYDRATE_AMF_COLLECTION);
$classes = getClassesAndInfo();
$config = new Amfphp_Core_Config();
$config->checkArgumentCount = false;
$config->serviceFolderPaths = array(realpath(Configuration::get("PHP_SERVICES")));
$config->serviceNames2ClassFindInfo = $classes;
$gateway = Amfphp_Core_HttpRequestGatewayFactory::createGateway($config);
$gateway->service();
$gateway->output();
function getClassesAndInfo()
{
$phpServicesDir = Configuration::get("PHP_SERVICES");
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($phpServicesDir), RecursiveIteratorIterator::LEAVES_ONLY);
$classes = array();
foreach($files as $file)
{
if(empty($file))
continue;
$e = explode('.', $file->getFileName());
if(empty($e) || count($e) < 2)
continue;
$path = $file->getRealPath();
$className = $e[0];
$extension = $e[1];
if($extension != "php")
continue;
require_once($path);
$classes[$className] = new Amfphp_Core_Common_ClassFindInfo($path, $className);
}
return $classes;
}