PHP code example of arabcoders / dependency

1. Go to this page and download the library: Download arabcoders/dependency library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

arabcoders / dependency example snippets




alize  = new \arabcoders\dependency\NormalizeNames();
$extentions = new \arabcoders\dependency\ParseExtensions( $normalize );
$parser     = new \arabcoders\dependency\ParseToken( $normalize );

$files = new RegexIterator(
    new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator( __DIR__ . '/dummydata' )
    ),
    '/^.+\.php$/i',
    RecursiveRegexIterator::GET_MATCH
);

$dependency = new \arabcoders\dependency\Dependency( $normalize, $extentions->run(), $parser, $files, [ ] );

print PHP_EOL . PHP_EOL . 'Get count for each extension call';

$dependency->run();

foreach ( $dependency->getCountPerExtensionCalls() as $extention => $calls )
{
    print sprintf( PHP_EOL . PHP_EOL . '** Extention ( %s ) **' . PHP_EOL . PHP_EOL, $extention );
    foreach ( $calls as $call => $count )
    {
        print sprintf( '* %s: %d' . PHP_EOL, $call, $count );
    }
}

print PHP_EOL . PHP_EOL . 'Get count for each extension' . PHP_EOL . PHP_EOL;

foreach ( $dependency->getCountPerExtention() as $extention => $count )
{
    print sprintf( '** %s: %d **' . PHP_EOL, $extention, $count );
}