Two ways depending of SAPI used.
If you’re on Windows or Mac platform, you may have Growl. If you’re on Linux, the default bundled growl notifier is not for you. Skip this section.
![]() | |
|
You’ll add to configure your plugin in your phpreflect.json
file, as follow :
{ "name": "Notifier", "class": "Bartlett\\Reflect\\Plugin\\NotifierPlugin", "options" : "Bartlett\\CompatInfo\\Plugin\\Notifier\\GrowlNotifier" }
name
key is (since version 3.0.0-alpha1) comment only.
class
key identify the name of the class that implement the plugin (must be fully qualified).
options
key identify the name of the class that implement the notifier (must be fully qualified).
Default behaviors are :
reflect.progress
and reflect.success
events (enabled
option set to false)
reflect.error
and reflect.complete
events, and keep them displayed (sticky
option set to true).
gntp
protocol rather than udp
basic protocol.
If one or all of those behaviors does not match your need, here is how to change it.
Creates your own growl notifier class, (E.g: YourNamespace\MyGrowlNotifier
)
and put it in somewhere in your include_path
.
<?php namespace YourNamespace; use Bartlett\Reflect\Plugin\Notifier\GrowlNotifier as BaseGrowlNotifier; class MyGrowlNotifier extends BaseGrowlNotifier { public function __construct($application = 'myPhpReflect', $notifications = array(), $password = '', $options = array() { parent::__construct($application, $notifications, $password, $options); } }
We have changed the Growl Application Name to myPhpReflect
, and used the udp
protocol.
![]() | |
See http://growl.laurent-laville.org/ to learn more about PEAR/Net_Growl package. |
You have just to run the analyser:run
command, and you will be notified when parse is completed.
This is the standard analyser run process as defined in following script.
Default behavior is to activate all plugins that can be registered in the PluginManager
.
<?php use Bartlett\Reflect\Environment; use Bartlett\Reflect\Client; // set default values for BARTLETT_SCAN_DIR Environment::setScanDir() // set default value for BARTLETTRC putenv("BARTLETTRC=phpreflect.json"); // creates an instance of client $client = new Client(); // request for a Bartlett\Reflect\Api\Analyser $api = $client->api('analyser'); // perform request, on a data source with default analyser (structure) $dataSource = dirname(__DIR__) . '/src'; $analysers = array('structure'); // equivalent to CLI command `phpreflect analyser:run ../src` $metrics = $api->run($dataSource, $analysers); var_export($metrics);