File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ AWS Lambda change log
33
44## ?.?.? / ????-??-??
55
6+ * Sticking to the principle * Be liberal in what you accept* , made it
7+ possible to use pass class filenames to ` xp lambda run ` .
8+ (@thekid )
69* Fixed issue #24 : Syntax error in PHP 7.0...7.3: ` unexpected '...' `
710 (@thekid )
811
Original file line number Diff line number Diff line change 11<?php namespace xp \lambda ;
22
33use com \amazon \aws \lambda \{Context , Environment , Handler };
4- use lang \{XPClass , Throwable , IllegalArgumentException };
4+ use lang \{ClassLoader , Throwable , IllegalArgumentException };
55use util \UUID ;
66use util \cmd \Console ;
77
@@ -25,8 +25,13 @@ class RunLambda {
2525 * @throws lang.ClassLoadingException
2626 * @throws lang.IllegalArgumentException
2727 */
28- public function __construct ($ handler = 'Handler ' , array $ events = []) {
29- $ this ->impl = XPClass::forName ($ handler );
28+ public function __construct ($ handler , array $ events = []) {
29+ if (is_file ($ handler )) {
30+ $ this ->impl = ClassLoader::getDefault ()->loadUri ($ handler );
31+ } else {
32+ $ this ->impl = ClassLoader::getDefault ()->loadClass ($ handler );
33+ }
34+
3035 if (!$ this ->impl ->isSubclassOf (Handler::class)) {
3136 throw new IllegalArgumentException ('Class ' .$ handler .' is not a lambda handler ' );
3237 }
You can’t perform that action at this time.
0 commit comments