\Nano4Nano

The base class for the Nano framework.

Either make an instance of this directly, or make your own base class that extends this. As per the notice above, you cannot have more than one instance of a Nano-derived object at one time.

Summary

Methods
Properties
Constants
__construct()
__isset()
__set()
__unset()
__get()
offsetExists()
offsetSet()
offsetUnset()
offsetGet()
addMethod()
__call()
$lib
$methods
$opts
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$lib

$lib : 

Type

$methods

$methods : 

Type

$opts

$opts : 

Type

Methods

__construct()

__construct(  $opts = array()) 

Construct a new Nano object. By default we build a 'nano' loader which loads Nano extensions from our own folder. You can override the folder of the loader via the 'nanodir' option to the constructor.

This loader is expected to be available by other extensions, so don't mess with it. Oh, and it's a basic constructor, so it only loads libraries, nothing more, nothing less.

Parameters

$opts

__isset()

__isset(  $offset) 

See if we have a library loaded already.

Parameters

$offset

__set()

__set(  $offset,   $value) 

Use like: $nano->targetname = 'pluginname'; or: $nano->targetname = ['plugin'=>$name, .

..];

Parameters

$offset
$value

__unset()

__unset(  $offset) 

Not recommended, but no longer forbidden, except for 'plugins'.

Parameters

$offset

__get()

__get(  $offset) 

Get a library object from our collection.

This supports autoloading plugins using the 'plugins' plugin.

Parameters

$offset

offsetExists()

offsetExists(  $path) 

Does the option exist?

Parameters

$path

offsetSet()

offsetSet(  $path,   $value) 

Set an option.

Parameters

$path
$value

offsetUnset()

offsetUnset(  $path) 

Unset an option.

This simply sets the value to null. Maybe a future version will be more comprehensive.

Parameters

$path

offsetGet()

offsetGet(  $path) 

Get an option based on a path.

Parameters

$path

addMethod()

addMethod(string  $name, mixed  $callback) 

Add an extension method.

This function allows extensions to add a method to the Nano4 object.

Parameters

string $name

The name of the method we are adding.

mixed $callback

A callback, with exceptions, see below.

If the callback parameter is a string, then the normal PHP callback rules are ignored, and the string is assumed to be the name of a library object that provides the given method (the method in the library must be the same name, and must be public.)

Class method calls, object method calls and closures are handled as per the standard PHP callback rules.

__call()

__call(  $method,   $arguments) 

The __call() method looks for extension methods, and calls them.

Parameters

$method
$arguments