Example #1
0
 /**
  * The entry method.
  *
  * @return  int
  */
 public function main()
 {
     $directories = [];
     $files = [];
     $namespaces = [];
     $filter = [];
     $debug = false;
     $php = null;
     $concurrentProcesses = 2;
     while (false !== ($c = $this->getOption($v))) {
         switch ($c) {
             case 'a':
                 $iterator = new File\Finder();
                 $iterator->in(resolve('hoa://Library/', true, true))->directories()->maxDepth(1);
                 foreach ($iterator as $fileinfo) {
                     $libraryName = $fileinfo->getBasename();
                     if (true === Core\Consistency::isKeyword($libraryName)) {
                         continue;
                     }
                     $pathname = resolve('hoa://Library/' . $libraryName);
                     $tests = $pathname . DS . 'Test' . DS;
                     $manualTests = $tests . 'Unit';
                     $automaticTests = $tests . 'Praspel' . DS . 'Unit';
                     if (is_dir($manualTests)) {
                         $directories[] = $manualTests;
                     }
                     if (is_dir($automaticTests)) {
                         $directories[] = $automaticTests;
                     }
                 }
                 break;
             case 'l':
                 foreach ($this->parser->parseSpecialValue($v) as $library) {
                     $libraryName = ucfirst(strtolower($library));
                     $pathname = resolve('hoa://Library/' . $libraryName);
                     $tests = $pathname . DS . 'Test';
                     if (!is_dir($tests)) {
                         throw new Console\Exception('Library %s does not exist or has no test.', 0, $libraryName);
                     }
                     $directories[] = $tests;
                     $namespaces[] = 'Hoa\\' . $libraryName;
                 }
                 break;
             case 'n':
                 foreach ($this->parser->parseSpecialValue($v) as $namespace) {
                     $namespace = str_replace('.', '\\', $namespace);
                     $parts = explode('\\', $namespace);
                     if (2 > count($parts)) {
                         throw new Console\Exception('Namespace %s is too short.', 1, $namespace);
                     }
                     $head = resolve('hoa://Library/' . $parts[1]);
                     $tail = implode(DS, array_slice($parts, 2));
                     $namespaceDirectory = $head . DS . $tail;
                     if (!is_dir($namespaceDirectory)) {
                         throw new Console\Exception('Namespace %s does not exist.', 2, $namespace);
                     }
                     $tests = $head . DS . 'Test' . DS;
                     $manualTests = $tests . 'Unit' . DS . $tail;
                     $automaticTests = $tests . 'Praspel' . DS . 'Unit' . DS . $tail;
                     if (is_dir($manualTests)) {
                         $directories[] = $manualTests;
                     }
                     if (is_dir($automaticTests)) {
                         $directories[] = $automaticTests;
                     }
                     $namespaces[] = $namespace;
                 }
                 break;
             case 'd':
                 foreach ($this->parser->parseSpecialValue($v) as $directory) {
                     if (!is_dir($directory)) {
                         throw new Console\Exception('Directory %s does not exist.', 3, $directory);
                     }
                     $directories[] = $directory;
                 }
                 break;
             case 'f':
                 foreach ($this->parser->parseSpecialValue($v) as $file) {
                     if (!file_exists($file)) {
                         throw new Console\Exception('File %s does not exist.', 4, $file);
                     }
                     $files[] = $file;
                 }
                 break;
             case 'F':
                 $filter = $v;
                 break;
             case 'D':
                 $debug = $v;
                 break;
             case 'p':
                 $php = $v;
                 break;
             case 'P':
                 $concurrentProcesses = intval($v);
                 break;
             case '__ambiguous':
                 $this->resolveOptionAmbiguity($v);
                 break;
             case 'h':
             case '?':
             default:
                 return $this->usage();
                 break;
         }
     }
     $atoum = 'atoum';
     if (WITH_COMPOSER) {
         $atoum = __DIR__ . DS . '..' . DS . '..' . DS . '..' . DS . 'bin' . DS . 'atoum';
     } elseif (isset($_SERVER['HOA_ATOUM_BIN'])) {
         $atoum = $_SERVER['HOA_ATOUM_BIN'];
     }
     $command = $atoum . ' --configurations ' . resolve('hoa://Library/Test/.atoum.php') . ' --bootstrap-file ' . resolve('hoa://Library/Test/.bootstrap.atoum.php') . ' --force-terminal' . ' --max-children-number ' . $concurrentProcesses;
     if (true === $debug) {
         $command .= ' --debug';
     }
     if (null !== $php) {
         $command .= ' --php ' . $php;
     }
     if (!empty($directories)) {
         $command .= ' --directories ' . implode(' ', $directories);
     } elseif (!empty($files)) {
         $command .= ' --files ' . implode(' ', $files);
     } else {
         return $this->usage();
     }
     if (!empty($namespaces)) {
         $command .= ' --namespaces ' . implode(' ', $namespaces);
     }
     if (!empty($filter)) {
         $command .= ' --filter \'' . str_replace('\'', '\'"\'"\'', $filter) . '\'';
     }
     $_server = $_SERVER;
     $_server['HOA_PREVIOUS_CWD'] = getcwd();
     $processus = new Processus($command, null, null, resolve('hoa://Library/Test/'), $_server);
     $processus->on('input', function ($bucket) {
         return false;
     });
     $processus->on('output', function ($bucket) {
         $data = $bucket->getData();
         echo $data['line'], "\n";
         return;
     });
     $processus->run();
     return;
 }
Example #2
0
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\Stream\Wrapper\IWrapper;

use Hoa\Core;
/**
 * Interface \Hoa\Stream\Wrapper\IWrapper.
 *
 * Interface for stream wrapper class.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
interface IWrapper extends File, Stream
{
    /**
     * Constructs a new stream wrapper.
     * Called when opening the stream wrapper, right before self::stream_open().
     *
     * @return  void
     */
    public function __construct();
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Stream\\Wrapper\\IWrapper\\IWrapper');
Example #3
0
        $old = $this->_praspelVisitor;
        $this->_praspelVisitor = $visitor;
        return $old;
    }
    /**
     * Get Praspel visitor.
     *
     * @return  \Hoa\Visitor\Visit
     */
    public function getPraspelVisitor()
    {
        return $this->_praspelVisitor ?: static::getDefaultPraspelVisitor();
    }
    /**
     * Accept a visitor.
     *
     * @param   \Hoa\Visitor\Visit  $visitor    Visitor.
     * @param   mixed               &$handle    Handle (reference).
     * @param   mixed               $eldnah     Handle (no reference).
     * @return  mixed
     */
    public function accept(Visitor\Visit $visitor, &$handle = null, $eldnah = null)
    {
        return $visitor->visit($this, $handle, $eldnah);
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Realdom\\Realdom');
Example #4
0
                case 'double':
                    $self->withFloat((double) $value->readAll());
                    break;
                case 'i4':
                case 'int':
                    $self->withInteger((int) $value->readAll());
                    break;
                case 'string':
                    $self->withString(htmlspecialchars_decode($value->readAll()));
                    break;
                case 'struct':
                    $self = $self->withStructure();
                    foreach ($value->member as $member) {
                        $self->withName($member->name->readAll());
                        $this->computeValues($member->xpath('./value/*'), $self);
                    }
                    $self = $self->endStructure();
                    break;
                case 'nil':
                    $self->withNull();
                    break;
            }
        }
        return;
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\XmlRpc\\Message\\Message');
Example #5
0
     * @param   \Hoa\Ruler\Context    $context    Context.
     * @return  \Hoa\Ruler\Visitor\Asserter
     */
    public static function getDefaultAsserter(Context $context = null)
    {
        if (null === static::$_defaultAsserter) {
            static::$_defaultAsserter = new Visitor\Asserter($context);
        }
        if (null !== $context) {
            static::$_defaultAsserter->setContext($context);
        }
        return static::$_defaultAsserter;
    }
    /**
     * Get compiler.
     *
     * @return  \Hoa\Compiler\Llk\Parser
     */
    public static function getCompiler()
    {
        if (null === static::$_compiler) {
            static::$_compiler = Compiler\Llk::load(new File\Read('hoa://Library/Ruler/Grammar.pp'));
        }
        return static::$_compiler;
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Ruler\\Ruler');
Example #6
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\Iterator\Recursive;

use Hoa\Core;
/**
 * Class \Hoa\Iterator\Recursive.
 *
 * Extending the SPL RecursiveIterator interface.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
interface Recursive extends \RecursiveIterator
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Iterator\\Recursive\\Recursive');
Example #7
0
    }
    /**
     * Get domain of an adress from a contact string.
     * With the example of self::getAddress, we will get freeman.net.
     *
     * @return  string
     */
    public static function getDomain($contact)
    {
        $address = static::getAddress($contact);
        if (false !== ($pos = strpos($address, '@'))) {
            return substr($address, $pos + 1);
        }
        return $address;
    }
    /**
     * Transform this object as a string.
     * Alias of $this->getFormattedContent().
     *
     * @return  string
     */
    public function __toString()
    {
        return $this->getFormattedContent();
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Mail\\Content\\Content');
Example #8
0
        $width = $width - $margin - 18;
        $format = '%-' . $margin . 's  %-' . $width . 's %5dms, %5.1f%%' . "\n";
        foreach ($stats as $id => $stat) {
            $out .= sprintf($format, $id, str_repeat('|', round($stat[self::STAT_POURCENT] * $width / 100)), round(1000 * $stat[self::STAT_RESULT]), round($stat[self::STAT_POURCENT], 3));
        }
        return $out;
    }
    /**
     * Count the number of mark.
     *
     * @return  int
     */
    public function count()
    {
        return count(self::$_mark);
    }
    /**
     * Alias of drawStatistic() method.
     *
     * @return  string
     */
    public function __toString()
    {
        return $this->drawStatistic();
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Bench\\Bench');
Example #9
0
        }
        throw new Exception('Selector %s is not a valid selector.', 22, $selector);
    }
    /**
     * Destruct XYL object.
     *
     * @return  void
     */
    public function __destruct()
    {
        $protocol = Core::getInstance()->getProtocol();
        unset($protocol['Library']['Xyl[' . $this->_i . ']']);
        return;
    }
}
/**
 * Class \Hoa\Xyl\_Protocol.
 *
 * hoa://Library/Xyl component.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
class _Protocol extends Core\Protocol
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Xyl\\Xyl');
event('hoa://Event/Exception')->attach(xcallable('Hoa\\Xyl\\Interpreter\\Common\\Debug', 'receiveException'));
Example #10
0
     * Get a query (a clone of it).
     *
     * @param   string  $id    ID.
     * @return  \Hoa\Database\Query\Dml
     */
    public static function get($id)
    {
        if (null === ($out = static::getReference($id))) {
            return null;
        }
        return clone $out;
    }
    /**
     * Get a query (not a clone of it).
     *
     * @param   string  $id    ID.
     * @return  \Hoa\Database\Query\Dml
     */
    public static function getReference($id)
    {
        if (false === array_key_exists($id, static::$_queries)) {
            return null;
        }
        return static::$_queries[$id];
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Database\\Query\\Query');
Example #11
0
    public function getTransport()
    {
        return $this->_transport;
    }
    /**
     * Get a string that represents the socket address.
     *
     * @return  string
     */
    public function __toString()
    {
        $out = null;
        if (true === $this->hasTransport()) {
            $out .= $this->getTransport() . '://';
        }
        if (true === $this->hasPort()) {
            if (self::ADDRESS_IPV6 === $this->getAddressType()) {
                $out .= '[' . $this->getAddress() . ']';
            } else {
                $out .= $this->getAddress();
            }
            return $out . ':' . $this->getPort();
        }
        return $out . $this->getAddress();
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Socket\\Socket');
Example #12
0
         * Get registry of all contracts.
         *
         * @return  \ArrayObject
         */
        public static function getRegistry()
        {
            if (null === static::$_registry) {
                static::$_registry = new \ArrayObject();
            }
            return static::$_registry;
        }
    }
    /**
     * Flex entity.
     */
    Core\Consistency::flexEntity('Hoa\\Praspel\\Praspel');
}
namespace {
    /**
     * Alias of \Hoa\Praspel::interpret().
     *
     * @param   string  $praspel    Praspel
     * @return  \Hoa\Praspel\Model\Clause
     */
    if (!function_exists('praspel')) {
        function praspel($praspel)
        {
            return Hoa\Praspel::interpret($praspel);
        }
    }
}
Example #13
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\File\Exception;

use Hoa\Core;
/**
 * Class \Hoa\File\Exception.
 *
 * Extending the \Hoa\Core\Exception class.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
class Exception extends Core\Exception
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\File\\Exception\\Exception');
Example #14
0
        if (0 === $n) {
            return [];
        }
        $out = [];
        $tmp = null;
        $i = 0;
        $o = array_fill(0, $n, 0);
        $o[0] = $k;
        while ($k != $o[$i = $n - 1]) {
            if (false === $withoutZero || !in_array(0, $o)) {
                $out[] = $o;
            }
            $tmp = $o[$i];
            $o[$i] = 0;
            while ($o[$i] == 0) {
                --$i;
            }
            --$o[$i];
            $o[$i + 1] = $tmp + 1;
        }
        if (false === $withoutZero || !in_array(0, $o)) {
            $out[] = $o;
        }
        return $out;
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Math\\Combinatorics\\Combination\\Combination');
Example #15
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\Praspel\Exception;

use Hoa\Core;
/**
 * Interface \Hoa\Praspel\Exception.
 *
 * Interface representing Hoa\Praspel exceptions.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
interface Exception
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Praspel\\Exception\\Exception');
Example #16
0
     *
     * @return  bool
     */
    public function eof()
    {
        return feof($this->getStream());
    }
    /**
     * Get filename component of path.
     *
     * @return  string
     */
    public function getBasename()
    {
        return basename($this->getSocket()->__toString());
    }
    /**
     * Get directory name component of path.
     *
     * @return  string
     */
    public function getDirname()
    {
        return dirname($this->getSocket()->__toString());
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Socket\\Connection\\Connection');
Example #17
0
/**
 * Interface \Hoa\Console\Readline\Autocompleter.
 *
 * Interface for all auto-completers.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
interface Autocompleter
{
    /**
     * Complete a word.
     * Returns null for no word, a full-word or an array of full-words.
     *
     * @param   string  &$prefix    Prefix to autocomplete.
     * @return  mixed
     */
    public function complete(&$prefix);
    /**
     * Get definition of a word.
     * Example: \b\w+\b. PCRE delimiters and options must not be provided.
     *
     * @return  string
     */
    public function getWordDefinition();
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Console\\Readline\\Autocompleter\\Autocompleter');
Example #18
0
                        $tokens[$matches[1]] = [];
                    }
                    $tokens[$matches[1]][$matches[2]] = $matches[3];
                } else {
                    throw new Compiler\Exception('Unrecognized instructions:' . "\n" . '    %s' . "\n" . 'in file %s at line %d.', 1, [$line, $stream->getStreamName(), $i + 1]);
                }
                continue;
            }
            $ruleName = substr($line, 0, -1);
            $rule = null;
            ++$i;
            while ($i < $m && isset($lines[$i][0]) && (' ' === $lines[$i][0] || "\t" === $lines[$i][0] || '//' === substr($lines[$i], 0, 2))) {
                if ('//' === substr($lines[$i], 0, 2)) {
                    ++$i;
                    continue;
                }
                $rule .= ' ' . trim($lines[$i++]);
            }
            if (isset($lines[$i][0])) {
                --$i;
            }
            $rules[$ruleName] = $rule;
        }
        return;
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Compiler\\Llk\\Llk');
Example #19
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\Compiler\Exception;

use Hoa\Core;
/**
 * Class \Hoa\Compiler\Exception.
 *
 * Extending the \Hoa\Core\Exception class.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
class Exception extends Core\Exception
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Compiler\\Exception\\Exception');
Example #20
0
        throw new File\Exception('Cannot find an appropriated object that matches with ' . 'path %s when defining it.', 1, $target);
    }
    /**
     * Get the target name of a symbolic link.
     *
     * @return  string
     */
    public function getTargetName()
    {
        return readlink($this->getStreamName());
    }
    /**
     * Create a link.
     *
     * @param   string  $name      Link name.
     * @param   string  $target    Target name.
     * @return  bool
     */
    public static function create($name, $target)
    {
        if (false != linkinfo($name)) {
            return true;
        }
        return symlink($target, $name);
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\File\\Link\\Link');
Example #21
0
    public function getService($serviceId)
    {
        if (false === $this->serviceExists($serviceId)) {
            throw new Exception('Service %s does not exist.', 9, $serviceId);
        }
        return $this->services[$serviceId];
    }
    /**
     * Get all services.
     *
     * @return  array
     */
    protected function getServices()
    {
        return $this->services;
    }
    /**
     * Transform the groups to DOT language.
     *
     * @return  string
     */
    public function __toString()
    {
        return $this->getGroups()->__toString();
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Acl\\Acl');
Example #22
0
    public function __construct(Praspel\Model\Specification $specification)
    {
        $this->_iterator = new Structural($specification);
        return;
    }
    /**
     * Set coverage criteria.
     *
     * @param   int  $criteria    Criteria (please, see self::CRITERIA_*
     *                            constants).
     * @return  int
     */
    public function setCriteria($criteria)
    {
        return $this->_iterator->setCriteria($criteria);
    }
    /**
     * Get iterator.
     *
     * @return  \Hoa\Iterator\Recursive\Iterator
     */
    public function getIterator()
    {
        return new Iterator\Recursive\Iterator($this->_iterator);
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Praspel\\Iterator\\Coverage\\Coverage');
Example #23
0
 * @license    New BSD License
 */
class _Protocol extends Core\Protocol
{
    /**
     * Component's name.
     *
     * @var string
     */
    protected $_name = 'Registry';
    /**
     * ID of the component.
     *
     * @param   string  $id    ID of the component.
     * @return  mixed
     */
    public function reachId($id)
    {
        return Registry::get($id);
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Registry\\Registry');
/**
 * Add the hoa://Library/Registry component. Should be use to reach/get an entry
 * in the \Hoa\Registry, e.g.: resolve('hoa://Library/Registry#AnID').
 */
$protocol = Core::getInstance()->getProtocol();
$protocol['Library'][] = new _Protocol();
Example #24
0
        }
        session_destroy();
        static::$_started = false;
        // let locks unchanged.
        return;
    }
    /**
     * Get current session ID.
     *
     * @return  string
     */
    public static function getId()
    {
        return session_id();
    }
    /**
     * Update the current session ID with a newly generated one.
     *
     * @param   bool  $deleteOldSession    Delete the old session file or not.
     * @return  bool
     */
    public static function newId($deleteOldSession = false)
    {
        return session_regenerate_id($deleteOldSession);
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Session\\Session');
Example #25
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\Math\Exception;

use Hoa\Core;
/**
 * Class \Hoa\Math\Exception.
 *
 * Extending the \Hoa\Core\Exception class.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
class Exception extends Core\Exception
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Math\\Exception\\Exception');
Example #26
0
    /**
     * Component's name.
     *
     * @var string
     */
    protected $_name = 'Stream';
    /**
     * ID of the component.
     *
     * @param   string  $id    ID of the component.
     * @return  mixed
     */
    public function reachId($id)
    {
        return Stream::getStreamHandler($id);
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Stream\\Stream');
/**
 * Shutdown method.
 */
Core::registerShutdownFunction('\\Hoa\\Stream\\Stream', '_Hoa_Stream');
/**
 * Add the hoa://Library/Stream component. Should be use to reach/get an entry
 * in the \Hoa\Stream register.
 */
$protocol = Core::getInstance()->getProtocol();
$protocol['Library'][] = new _Protocol();
Example #27
0
    /**
     * Get the current tput instance of the current process.
     *
     * @return  \Hoa\Console\Tput
     */
    public static function getTput()
    {
        if (null === static::$_tput) {
            static::$_tput = new Tput();
        }
        return static::$_tput;
    }
    /**
     * Check whether we are running behind TMUX(1).
     *
     * @return  bool
     */
    public static function isTmuxRunning()
    {
        return isset($_SERVER['TMUX']);
    }
}
/**
 * Restore interaction.
 */
Core::registerShutdownFunction('Hoa\\Console\\Console', 'restoreInteraction');
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Console\\Console');
Example #28
0
     *
     * @param   bool    $loop    Allow or not loop.
     * @return  bool
     */
    public function allowLoop($loop = self::DISALLOW_LOOP)
    {
        $old = $this->loop;
        $this->loop = $loop;
        return $old;
    }
    /**
     * Get the loop mode.
     *
     * @return  bool
     */
    public function isLoopAllow()
    {
        return $this->loop;
    }
    /**
     * Print the graph in the DOT language.
     *
     * @return  string
     */
    public abstract function __toString();
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Graph\\Graph');
Example #29
0
     * @return  void
     */
    public function setComponent($element, $component)
    {
        $this->_rank[$element] = $component;
        return;
    }
    /**
     * Get rank.
     *
     * @return  array
     */
    public function getRank()
    {
        return $this->_rank;
    }
    /**
     * Get resource path.
     *
     * @return  string
     */
    public function getResourcePath()
    {
        return $this->_resourcePath;
    }
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Xyl\\Interpreter\\Interpreter');
Example #30
0
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
namespace Hoa\Http\Exception;

use Hoa\Core;
/**
 * Class \Hoa\Http\Exception.
 *
 * Extending the \Hoa\Core\Exception class.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
class Exception extends Core\Exception
{
}
/**
 * Flex entity.
 */
Core\Consistency::flexEntity('Hoa\\Http\\Exception\\Exception');