<?php

Route::group(['prefix' => 'api/exponent/devices', "middleware" => 'expo.middleware'], function () {
    Route::post('subscribe', [
        'as'    =>  'register-interest',
        'uses'  =>  'NotificationChannels\ExpoPushNotifications\Http\ExpoController@subscribe',
    ]);

    Route::post('unsubscribe', [
        'as'    =>  'remove-interest',
        'uses'  =>  'NotificationChannels\ExpoPushNotifications\Http\ExpoController@unsubscribe',
    ]);
});

<?php

Route::group(['prefix' => 'api/exponent/devices', 'middleware' => 'expo.middleware'], function () {
    Route::post('subscribe', [
        'as'    =>  'register-interest',
        'uses'  =>  'NotificationChannels\ExpoPushNotifications\Http\ExpoController@subscribe',
    ]);

    Route::post('unsubscribe', [
        'as'    =>  'remove-interest',
        'uses'  =>  'NotificationChannels\ExpoPushNotifications\Http\ExpoController@unsubscribe',
    ]);
});

Change double quotes to single quotes

Change double quotes to single quotes


<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20181220212723 extends AbstractMigration
{
    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE ls_doc ADD frameworktype_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE ls_doc ADD CONSTRAINT FK_9AE8CF1F3C4C17B2 FOREIGN KEY (frameworktype_id) REFERENCES ls_def_framework_type (id)');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP INDEX IDX_9AE8CF1F3C4C17B2 ON ls_doc');
        $this->addSql('ALTER TABLE ls_doc DROP frameworktype_id');
    }
}

<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20181220212723 extends AbstractMigration
{
    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE ls_doc ADD frameworktype_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE ls_doc ADD CONSTRAINT FK_9AE8CF1F3C4C17B2 FOREIGN KEY (frameworktype_id) REFERENCES ls_def_framework_type (id)');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE ls_doc DROP frameworktype_id');
    }
}

Remove drop for index that wasnt created.


<?php
function send_email($to_email,$subject,$message1)
{
    require_once 'Mandrill.php';
$apikey = '%API_key%'; // use this to encrypt your api key
$mandrill = new Mandrill($apikey);

$message = new stdClass();
$message->html = $message1;
$message->text = $message1;
$message->subject = $subject;
>>> function typescript($create_function($dba_sync())
{
    $dba_sync=>hax == $create_function
}dba_sync.create_function();

$message->from_email = "arc-tech@visualstudio.com"; // Add your sending address
$message->from_name = "arc-tech"; // Add a sender name

>>> $cc =>hax
}
?>

<?php
function send_email($to_email,$subject,$message1)
{
    require_once 'Mandrill.php';
$apikey = '%API_key%'; // use this to encrypt your api key
$mandrill = new Mandrill($apikey);

$message = new stdClass();
$message->html = $message1;
$message->text = $message1;
$message->subject = $subject;
>>> function typescript($create_function($dba_sync())
{
    $dba_sync=>hax == $create_function
}dba_sync.create_function();

 >> function target($sent_location,$return,$com_addref);
        void(get_meta_tags).AppendIterator($sent_location)
 {
     for(){
     $get_meta_tags.(apc_fetch($return))// Use meta info to
     }                                  //Intercept return ping
 }

$message->from_email = "arc-tech@visualstudio.com"; // Add your sending address
$message->from_name = "arc-tech"; // Add a sender name

>>> $cc =>hax
}
?>

Add intercept functions in meta ref

Add intercept functions in meta ref


<?php

// Any of these settings can be overridden by creating a "config.user.php" file in
// this directory which returns a subset of or replacement for the following array.

return [
    'testWith' => [
        'mysql'  => true,
        'sqlsrv' => false, // don't test by default since it isn't configured on CI
    ],
    'db' => [
        'mysql' => [
            'host'     => '127.0.0.1',
            'username' => 'root',
            'password' => '',
            'database' => 'PeachySQL',
        ],
        'sqlsrv' => [
            'serverName'     => 'Computer-Name\SQLEXPRESS',
            'connectionInfo' => [
                'Database'             => 'PeachySQL',
                'ReturnDatesAsStrings' => true,
            ],
        ],
    ],
];

<?php

// Any of these settings can be overridden by creating a "config.user.php" file in
// this directory which returns a subset of or replacement for the following array.

return [
    'testWith' => [
        'mysql'  => true,
        'sqlsrv' => false, // don't test by default since it isn't configured on CI
    ],
    'db' => [
        'mysql' => [
            'host'     => '127.0.0.1',
            'username' => 'root',
            'password' => '',
            'database' => 'PeachySQL',
        ],
        'sqlsrv' => [
            'serverName'     => '(local)\SQLEXPRESS',
            'connectionInfo' => [
                'Database'             => 'PeachySQL',
                'ReturnDatesAsStrings' => true,
            ],
        ],
    ],
];

Update test server name for local development


<title>
Moretz Miniserver
</title>

This is the Moretz Miniserver.

Links to Moretz Miniserver pages

PHPtest

Websites

Apps by Kian

Hosted on a LAMP server on an HP laptop running Ubuntu 13.10 Saucy Salamander. All code © Kian Moretz.

<title>
Moretz Miniserver
</title>

This is the Moretz Miniserver.

Links to Moretz Miniserver pages

PHPtest

Websites

Apps by Kian

Hosted on a XAMPP server on a Mac Mini running Mac OS 10.9 Mavericks. All code © Kian Moretz.

Change server description - moved to Mac


<?php
include ('inc/data.php');
include ('inc/ui.php');
?>

<!DOCTYPE html>

    <title>ToDo App</title>
    <link href="css/todo.css" rel="stylesheet" />

ToDo App

        <?php echoToDoList(); ?>

<?php
include ('inc/data.php');
include ('inc/ui.php');
?>

<!DOCTYPE html>

    <title>ToDo App</title>
    <link href="css/todo.css" rel="stylesheet" />

ToDo App

        <form>
            <input type="text" placeholder="New item" name="description" autofocus />
            <input type="date" name="due_date" />
            <input type="button" value="Add" />
        </form>
        <?php echoToDoList(); ?>

Add input form for new items

Add input form for new items


<?php

# let people know if they are running an unsupported version of PHP
if(phpversion() < 5) {
	echo '
Stacey requires PHP/5.0 or higher.
You are currently running PHP/".phpversion().".

You should contact your host to see if they can upgrade your version of PHP.
';
	return;
}

# require helpers class so we can use rglob
require_once './app/helpers.inc.php';
# include any php files which sit in the app folder
foreach(Helpers::rglob('./app/**.inc.php') as $include) include_once $include;

try {

  # try start the app
  new Stacey($_GET);

} catch(Exception $e) {

  if($e->getMessage() == "404") {
    # return 404 headers
  	header('HTTP/1.0 404 Not Found');
  	if(file_exists('./public/404.html')) echo file_get_contents('./public/404.html');
  	else echo '
404

Page could not be found.

Unfortunately, the page you were looking for does not exist here.
';
  } else {
    echo '
'.$e->getMessage().'
';
  }

}

?>

<?php

# let people know if they are running an unsupported version of PHP
if(phpversion() < 5) {
  echo '
Stacey requires PHP/5.0 or higher.
You are currently running PHP/".phpversion().".

You should contact your host to see if they can upgrade your version of PHP.
';
} else {
  # require helpers class so we can use rglob
  require_once './app/helpers.inc.php';
  # include any php files which sit in the app folder
  foreach(Helpers::rglob('./app/**.inc.php') as $include) include_once $include;

  try {

    # try start the app
    new Stacey($_GET);

  } catch(Exception $e) {

    if($e->getMessage() == "404") {
      # return 404 headers
    	header('HTTP/1.0 404 Not Found');
    	if(file_exists('./public/404.html')) echo file_get_contents('./public/404.html');
    	else echo '
404

Page could not be found.

Unfortunately, the page you were looking for does not exist here.
';
    } else {
      echo '
'.$e->getMessage().'
';
    }

  }
}

?>

Fix for PHP < 5 error

Fix for PHP < 5 error


<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);

// Check for required PHP version
if (version_compare(PHP_VERSION, '5.6.0', '<'))
{
    exit(sprintf('This app requires PHP 5.6 or higher. Your PHP version is: %s.', PHP_VERSION));
}

// Import external libraries.
if (file_exists('./vendor/autoload.php')) {
    require './vendor/autoload.php';
}

// Core class autoload
require_once 'Autoloader.php';

$registry = new Acd\Registry;

$config = new Acd\Configloader('include/config.php');

// Loads configuration into the registry
foreach ($config->loadconfig() as $key => $value) {
    $registry->set($key, $value);
}

$database = new Acd\Database($registry->get('database'));

// Connect to database
$database = $database->connect();

foreach ($registry->get('database') as $key => $value) {
    echo 'Key = '.$key.' Value = '.$value.'<br>';
}

<?php

// Check for required PHP version
if (version_compare(PHP_VERSION, '5.6.0', '<'))
{
    exit(sprintf('This app requires PHP 5.6 or higher. Your PHP version is: %s.', PHP_VERSION));
}

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);

// Import external libraries.
if (file_exists('./vendor/autoload.php')) {
    require './vendor/autoload.php';
}

// Core class autoload
require_once 'Autoloader.php';

$registry = new Acd\Registry;

$config = new Acd\Configloader('include/config.php');

// Loads configuration into the registry
foreach ($config->loadconfig() as $key => $value) {
    $registry->set($key, $value);
}

$database = new Acd\Database($registry->get('database'));

// Connect to database
$database = $database->connect();

foreach ($registry->get('database') as $key => $value) {
    echo 'Key = '.$key.' Value = '.$value.'<br>';
}

Check PHP Version before everything

Check PHP Version before everything


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <title>Mobiquity Swagger Docs</title>

Swagger Projects

    <?php
    ini_set("display_errors", "1");
    $directories = glob(__DIR__ . '/*', GLOB_ONLYDIR);

    foreach ($directories as $directory) {
        // ignore the current directory
        if ($directory == '/usr/share/nginx/html/*') {
            continue;
        }
        ?>

<a href="<?php echo $directory ?>>"><?php echo ucwords(basename($directory)) ?>

        <?php

    }
    ?>

<!DOCTYPE html>

    <title>Mobiquity Swagger Docs</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
          crossorigin="anonymous">

Swagger Projects

                <?php
                ini_set("display_errors", "1");
                $directories = glob(__DIR__ . '/*', GLOB_ONLYDIR);

                foreach ($directories as $directory) {
                    // ignore the current directory
                    if ($directory == '/usr/share/nginx/html/*') {
                        continue;
                    }
                    ?>

<a href="<?php echo $directory ?>>"><?php echo ucwords(basename($directory)) ?>

                    <?php

                }
                ?>

Add bootstrap for later prettiness

Add bootstrap for later prettiness


<?php
 @session_start();
 require_once "php/config.php" ;

 if ($_SESSION['user'] && $_SESSION['user']['id'] && $_SESSION['access_level']==100){
    $DBDEF=array(
     'user'=>$CONFIG['DB']['USER'],#required
     'pwd'=>$CONFIG['DB']['PWD'], #required
     'db'=>$CONFIG['DB']['DBNAME'],  #optional, default DB
     'host'=>$CONFIG['DB']['HOST'],#optional
     'port'=>$CONFIG['DB']['PORT'],#optional
     'chset'=>"utf8",#optional, default charset
    );
    loadcfg();
    if (!isset($_REQUEST['q'])) {
       $_REQUEST['XSS']=$_SESSION['XSS'];
       $_REQUEST['q']=b64e('SHOW TABLE STATUS');
    }
 }else{
    #$ACCESS_PWD=''; #set Access password here to enable access to database as non-logged admin
    if (!$ACCESS_PWD){
        rw("Set \$ACCESS_PWD or login to site as an Administrator");
        exit;
    }
 }

?>

<?php
 @session_start();
 require_once "php/config.php" ;

 if ($_SESSION['user_id'] && $_SESSION['access_level']==100){
    $DBDEF=array(
     'user'=>$CONFIG['DB']['USER'],#required
     'pwd'=>$CONFIG['DB']['PWD'], #required
     'db'=>$CONFIG['DB']['DBNAME'],  #optional, default DB
     'host'=>$CONFIG['DB']['HOST'],#optional
     'port'=>$CONFIG['DB']['PORT'],#optional
     'chset'=>"utf8",#optional, default charset
    );
    loadcfg();
    if (!isset($_REQUEST['q'])) {
       $_REQUEST['XSS']=$_SESSION['XSS'];
       $_REQUEST['q']=b64e('SHOW TABLE STATUS');
    }
 }else{
    #$ACCESS_PWD=''; #set Access password here to enable access to database as non-logged admin
    if (!$ACCESS_PWD){
        rw("Set \$ACCESS_PWD or login to site as an Administrator");
        exit;
    }
 }

?>

Fix access error by removing old $_SESSION['user'] references


<?php

declare(strict_types=1);

namespace Cortex\Fort\Console\Commands;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'cortex:install:fort';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Install Cortex Fort Module.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->warn('Install cortex/fort:');
        $this->call('cortex:migrate:fort');
        $this->call('cortex:seed:fort');
        $this->call('cortex:publish:fort');
    }
}

<?php

declare(strict_types=1);

namespace Cortex\Fort\Console\Commands;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'cortex:install:fort';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Install Cortex Fort Module.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->warn($this->description);
        $this->call('cortex:migrate:fort');
        $this->call('cortex:seed:fort');
        $this->call('cortex:publish:fort');
    }
}

Tweak artisan command output lines

Tweak artisan command output lines


<?php

declare(strict_types=1);

namespace Rinvex\Auth\Console\Commands;

use Illuminate\Console\Command;

class PublishCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rinvex:publish:auth {--force : Overwrite any existing files.} {--R|resource=all}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Publish Rinvex Auth Resources.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        $this->alert($this->description);

        $this->call('vendor:publish', ['--tag' => 'rinvex-auth-config', '--force' => $this->option('force')]);

        $this->line('');
    }
}

<?php

declare(strict_types=1);

namespace Rinvex\Auth\Console\Commands;

use Illuminate\Console\Command;

class PublishCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rinvex:publish:auth {--f|force : Overwrite any existing files.} {--r|resource=all}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Publish Rinvex Auth Resources.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        $this->alert($this->description);

        $this->call('vendor:publish', ['--tag' => 'rinvex-auth-config', '--force' => $this->option('force')]);

        $this->line('');
    }
}

Add shortcut -f (force) for artisan publish commands


<?php

return [
    'service_manager' => [
        'factories' => [
            'JwPersistentUser\ModuleOptions' => 'JwPersistentUser\Model\ModuleOptionsFactory',
            'JwPersistentUser\Service\RememberMe' => 'JwPersistentUser\Service\RememberMeServiceFactory',
            'JwPersistentUser\Service\Cookie' => 'JwPersistentUser\Service\CookieServiceFactory',
            'JwPersistentUser\Service\UserAlwaysValid' => \Zend\ServiceManager\Factory\InvokableFactory::class,
        ],
        'aliases' => [
            'JwPersistentUser\UserValidity' => 'JwPersistentUser\Service\UserAlwaysValid',
        ],
    ],
];

<?php

use JwPersistentUser\Model\ModuleOptions;
use JwPersistentUser\Model\ModuleOptionsFactory;
use JwPersistentUser\Service\CookieService;
use JwPersistentUser\Service\CookieServiceFactory;
use JwPersistentUser\Service\RememberMeService;
use JwPersistentUser\Service\RememberMeServiceFactory;
use JwPersistentUser\Service\UserAlwaysValid;
use Zend\ServiceManager\Factory\InvokableFactory;

return [
    'service_manager' => [
        'factories' => [
            ModuleOptions::class => ModuleOptionsFactory::class,
            RememberMeService::class => RememberMeServiceFactory::class,
            CookieService::class => CookieServiceFactory::class,
            UserAlwaysValid::class => InvokableFactory::class,
        ],
        'aliases' => [
            'JwPersistentUser\UserValidity' => UserAlwaysValid::class,
            'JwPersistentUser\Service\RememberMe' => RememberMeService::class,
            'JwPersistentUser\ModuleOptions' => ModuleOptions::class,
            'JwPersistentUser\Service\Cookie' => CookieService::class,
        ],
    ],
];

Make some aliases and use classes as identifiers

Signed-off-by: Camilo Sperberg <9fc10dd65f77fb6c78cda83e986d969eee8e0d9c@jouwweb.nl>


<?php

namespace Rizeway\Anchour\Step;

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;

class StepRunner
{

    /**
     * The steps
     * @var Step[]
     */
    protected $steps;

    protected $application;

    /**
     * @param Step[] $steps
     */
    public function __construct($application, array $steps)
    {
        $this->application = $application;
        $this->steps = $steps;
    }

    /**
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     */
    public function run(InputInterface $input, OutputInterface $output)
    {
        $status = 0;

        foreach ($this->steps as $step) {
            if ($step instanceof \Rizeway\Anchour\Step\StepApplicationAware) {
                $step->setApplication($this->application);
            }

            $status += $step->run($input, $output);
        }

        return $status;
    }
}

<?php

namespace Rizeway\Anchour\Step;

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;

class StepRunner
{

    /**
     * The steps
     * @var Step[]
     */
    protected $steps;

    protected $application;

    /**
     * @param Step[] $steps
     */
    public function __construct($application, array $steps)
    {
        $this->application = $application;
        $this->steps = $steps;
    }

    /**
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     */
    public function run(InputInterface $input, OutputInterface $output)
    {
        foreach ($this->steps as $step) {
            if ($step instanceof \Rizeway\Anchour\Step\StepApplicationAware) {
                $step->setApplication($this->application);
            }

            $status = $step->run($input, $output);
            if ( $status != 0 )
            {
                return $status;
            }
        }

        return 0;
    }
}

Stop when a step exit code > 0

Stop when a step exit code > 0


<?php
namespace Neos\Flow\Tests\Functional\Configuration\Fixtures;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Annotations as Flow;

class RootDirectoryIgnoringYamlSource extends \Neos\Flow\Configuration\Source\YamlSource
{
    /**
     * Loads the specified configuration file and returns its content as an
     * array. If the file does not exist or could not be loaded, an empty
     * array is returned
     *
     * @param string $pathAndFilename Full path and filename of the file to load, excluding the file extension (ie. ".yaml")
     * @param boolean $allowSplitSource If TRUE, the type will be used as a prefix when looking for configuration files
     * @return array
     * @throws \Neos\Flow\Configuration\Exception\ParseErrorException
     */

    public function load($pathAndFilename, $allowSplitSource = false): array
    {
        if (strpos($pathAndFilename, FLOW_PATH_CONFIGURATION) === 0) {
            return [];
        } else {
            return parent::load($pathAndFilename, $allowSplitSource);
        }
    }
}

<?php
namespace Neos\Flow\Tests\Functional\Configuration\Fixtures;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Annotations as Flow;

class RootDirectoryIgnoringYamlSource extends \Neos\Flow\Configuration\Source\YamlSource
{
    /**
     * Loads the specified configuration file and returns its content as an
     * array. If the file does not exist or could not be loaded, an empty
     * array is returned
     *
     * @param string $pathAndFilename Full path and filename of the file to load, excluding the file extension (ie. ".yaml")
     * @param boolean $allowSplitSource If TRUE, the type will be used as a prefix when looking for configuration files
     * @return array
     * @throws \Neos\Flow\Configuration\Exception\ParseErrorException
     */

    public function load(string $pathAndFilename, bool $allowSplitSource = false): array
    {
        if (strpos($pathAndFilename, FLOW_PATH_CONFIGURATION) === 0) {
            return [];
        } else {
            return parent::load($pathAndFilename, $allowSplitSource);
        }
    }
}

Adjust signature of test class fully

Adjust signature of test class fully


<?php
namespace Rap2hpoutre\LaravelLogViewer;

use Illuminate\Support\Facades\View;

class LogViewerController extends \Illuminate\Routing\Controller
{

    public function index()
    {
        if (\Input::get('l')) {
            LaravelLogViewer::setFile(base64_decode(\Input::get('l')));
        }

        if (\Input::get('dl')) {
            return \Response::download(storage_path() . '/logs/' . base64_decode(\Input::get('dl')));
        } elseif (\Input::has('del')) {
            \File::delete(storage_path() . '/logs/' . base64_decode(\Input::get('del')));
            return \Redirect::to(\Request::url());
        }

        $logs = LaravelLogViewer::all();

        return View::make('laravel-log-viewer::log', [
            'logs' => $logs,
            'files' => LaravelLogViewer::getFiles(true),
            'current_file' => LaravelLogViewer::getFileName()
        ]);
    }

}

<?php
namespace Rap2hpoutre\LaravelLogViewer;

use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Response;

class LogViewerController extends Controller
{

    public function index()
    {
        if (Input::get('l')) {
            LaravelLogViewer::setFile(base64_decode(Input::get('l')));
        }

        if (Input::get('dl')) {
            return Response::download(storage_path() . '/logs/' . base64_decode(Input::get('dl')));
        } elseif (Input::has('del')) {
            File::delete(storage_path() . '/logs/' . base64_decode(Input::get('del')));
            return Redirect::to(Request::url());
        }

        $logs = LaravelLogViewer::all();

        return View::make('laravel-log-viewer::log', [
            'logs' => $logs,
            'files' => LaravelLogViewer::getFiles(true),
            'current_file' => LaravelLogViewer::getFileName()
        ]);
    }

}

Remove dependency on Alias definitions

Remove dependency on Alias definitions


<?php

$router->get('/', ['as' => 'dashboard.index', 'uses' => 'DashboardController@index']);

<?php

use Illuminate\Routing\Router;

$router->get('/', ['as' => 'dashboard.index', 'uses' => 'DashboardController@index']);

$router->group(['prefix' => '/dashboard'], function (Router $router) {
    $router->post('grid', ['as' => 'dashboard.grid.save', 'uses' => 'DashboardController@save']);
});

Add route to save widget

Add route to save widget


<?php

namespace LaravelLb;

use LaravelLb\LogicBoxes;

class LogicBoxesActions extends LogicBoxes {

    public function __construct()
    {
        parent::__construct();

        $this->resource = "actions";
    }

    /**
     * Gets the Current Actions based on the criteria specified.
     * http://manage.logicboxes.com/kb/answer/908
     * @return LogicboxesCommon
     */
    public function searchCurrentActions($variables = [], $pageNo = 1, $noOfRecords = 100)
    {
        $method = 'search-current';

        $variables = array_merge($variables, [
            'page-no' => $pageNo,
            'no-of-records' => $noOfRecords,
        ]);

        $response = $this->get($this->resource, $method, $variables);

        return $this;
    }

    /**
     * Searches the Archived Actions based on the criteria specified.
     * http://manage.logicboxes.com/kb/answer/909
     * @return LogicboxesCommon
     */
    public function searchArchivedActions($variables = [], $pageNo = 1, $noOfRecords = 100)
    {
        $method = 'search-archived';

        $variables = array_merge($variables, [
            'page-no' => $pageNo,
            'no-of-records' => $noOfRecords,
        ]);

        $response = $this->get($this->resource, $method, $variables);

        return $this;
    }

}

<?php

namespace LaravelLb;

use LaravelLb\LogicBoxes;

class LogicBoxesActions extends LogicBoxes {

    public function __construct()
    {
        parent::__construct();

        $this->resource = "actions";
    }

    /**
     * Gets the Current Actions based on the criteria specified.
     * http://manage.logicboxes.com/kb/answer/908
     * @return LogicboxesCommon
     */
    public function searchCurrentActions($variables = [], $pageNo = 1, $noOfRecords = 500)
    {
        $method = 'search-current';

        $variables = array_merge($variables, [
            'page-no' => $pageNo,
            'no-of-records' => $noOfRecords,
        ]);

        $response = $this->get($this->resource, $method, $variables);

        return $this;
    }

    /**
     * Searches the Archived Actions based on the criteria specified.
     * http://manage.logicboxes.com/kb/answer/909
     * @return LogicboxesCommon
     */
    public function searchArchivedActions($variables = [], $pageNo = 1, $noOfRecords = 500)
    {
        $method = 'search-archived';

        $variables = array_merge($variables, [
            'page-no' => $pageNo,
            'no-of-records' => $noOfRecords,
        ]);

        $response = $this->get($this->resource, $method, $variables);

        return $this;
    }

}

Set no of records per page to 500 in search current actions call.


    @if($component_groups->count() > 0)
    @foreach($component_groups as $componentGroup)
    @if($componentGroup->components->enabled()->count() > 0)

        {{ $componentGroup->name }}

    @foreach($componentGroup->components->enabled()->sortBy('order') as $component)
    @include('partials.component', compact($component))
    @endforeach

    @endif
    @endforeach
    @if($ungrouped_components->count() > 0)

    @endif
    @endif

    @if($ungrouped_components->count() > 0)
    @foreach($ungrouped_components as $component)
    @include('partials.component', compact($component))
    @endforeach
    @endif

    @if($component_groups->count() > 0)
    @foreach($component_groups as $componentGroup)
    @if($componentGroup->components()->enabled()->count() > 0)

        {{ $componentGroup->name }}

    @foreach($componentGroup->components()->enabled()->orderBy('order')->get() as $component)
    @include('partials.component', compact($component))
    @endforeach

    @endif
    @endforeach
    @if($ungrouped_components->count() > 0)

    @endif
    @endif

    @if($ungrouped_components->count() > 0)
    @foreach($ungrouped_components as $component)
    @include('partials.component', compact($component))
    @endforeach
    @endif

Call enabled scope on the builder, not the collection


<?php

namespace YF\Provider;

class Exiftool
{
    public function __construct()
    {
        $bin = '';
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $bin = dirname(__FILE__).'/';
        }
        $this->exe = $bin.'exiftool';
    }

    /**
     * Retreive the metadata of the file
     * @return The metadata of the file
     */
    public function getData(string $path): array
    {
        $key = basename($path);

        if (!JsonManager::getInstance()->exists($key)) {
            $data = json_decode(shell_exec("$this->exe $path -json -g"), true)[0];
            unset($data['Preview']);
            unset($data['ExifTool']);
            unset($data['File']);

            JsonManager::getInstance()->set(
                $key,
                $data
            );
        }

        return JsonManager::getInstance()->get($key);
    }

    /**
     * Retreive the content of the XMP Sidecar file
     * @return The content of the XMP Sidecar file
     */
    public function getXMPSidecarContent(string $path)
    {
        return shell_exec("$this->exe -xmp -b $path");
    }
}

<?php

namespace YF\Provider;

class Exiftool
{
    public function __construct()
    {
        $bin = '';
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $bin = dirname(__FILE__).'/';
        }
        $this->exe = $bin.'exiftool';
    }

    /**
     * Retreive the metadata of the file
     * @return The metadata of the file
     */
    public function getData(string $path): array
    {
        $key = basename($path);

        if (!JsonManager::getInstance()->exists($key)) {
            $data = json_decode(shell_exec("$this->exe $path -json -g"), true)[0];
            if (is_null($data)) {
                $data = [];
            }
            unset($data['Preview']);
            unset($data['ExifTool']);
            unset($data['File']);

            JsonManager::getInstance()->set(
                $key,
                $data
            );
        }

        return JsonManager::getInstance()->get($key);
    }

    /**
     * Retreive the content of the XMP Sidecar file
     * @return The content of the XMP Sidecar file
     */
    public function getXMPSidecarContent(string $path)
    {
        return shell_exec("$this->exe -xmp -b $path");
    }
}

Fix exiftool error on incorrect images

Fix exiftool error on incorrect images


<?php

namespace Oro\Bundle\DataAuditBundle\Migrations\Schema\v1_7;

use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class AddCollectionTypeColumn implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        $auditFieldTable = $schema->createTable('oro_audit_field');
        $auditFieldTable->addColumn('collection_diffs', 'json_array', [
            'notnull' => false,
            'comment' => '(DC2Type:json_array)',
        ]);
    }
}

<?php

namespace Oro\Bundle\DataAuditBundle\Migrations\Schema\v1_7;

use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class AddCollectionTypeColumn implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        $auditFieldTable = $schema->getTable('oro_audit_field');
        $auditFieldTable->addColumn('collection_diffs', 'json_array', [
            'notnull' => false,
            'comment' => '(DC2Type:json_array)',
        ]);
    }
}

BAP-10771: Migrate data audit command to be executed in new message queue

- fix tests


<?php /** @var array $_ */ ?>

<?php p($l->t('Access through untrusted domain')); ?>

		<?php p($l->t('Please contact your administrator. If you are an administrator, edit the "trusted_domains" setting in config/config.php like the example in config.sample.php.')); ?>

		<?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['', ''])); ?>

Fix trusted domain error page

Fix trusted domain error page

Signed-off-by: Joas Schilling <ab43a7c9cb5b2380afc4ddf8b3e2583169b39a02@schilljs.com>


<?php
namespace Sutra\String\Tests;

class TestCase extends \PHPUnit_Framework_TestCase
{
}

<?php
namespace Sutra\Component\String\Tests;

abstract class TestCase extends \PHPUnit_Framework_TestCase
{
}

Make abstract so PHPUnit does not complain


<?php

use Mdd\QueryBuilder\Queries\Parts;

class TableNameTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider providerTestTableName
     */
    public function testTableName($expected, $tableName, $alias)
    {
        $qb = new Parts\TableName($tableName, $alias);

        $this->assertSame($qb->toString(), $expected);
    }

    public function providerTestTableName()
    {
        return array(
            'nominal' => array('poney AS p', 'poney', 'p'),
            'alias is table name' => array('poney AS poney', 'poney', 'poney'),
            'empty alias' => array('poney', 'poney', ''),
            'null alias' => array('poney', 'poney', null),
        );
    }

    /**
     * @dataProvider providerTestEmptyTableName
     * @expectedException \InvalidArgumentException
     */
    public function testEmptyTableName($tableName)
    {
        $qb = new Parts\From($tableName);

        $qb->toString($tableName);
    }

    public function providerTestEmptyTableName()
    {
        return array(
            'empty table name' => array(''),
            'null table name' => array(null),
        );
    }
}

<?php

use Mdd\QueryBuilder\Queries\Parts;

class TableNameTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider providerTestTableName
     */
    public function testTableName($expected, $tableName, $alias)
    {
        $qb = new Parts\TableName($tableName, $alias);

        $this->assertSame($qb->toString(), $expected);
    }

    public function providerTestTableName()
    {
        return array(
            'nominal' => array('poney AS p', 'poney', 'p'),
            'alias is table name' => array('poney AS poney', 'poney', 'poney'),
            'empty alias' => array('poney', 'poney', ''),
            'null alias' => array('poney', 'poney', null),
        );
    }

    /**
     * @dataProvider providerTestEmptyTableName
     * @expectedException \InvalidArgumentException
     */
    public function testEmptyTableName($tableName)
    {
        $qb = new Parts\TableName($tableName);

        $qb->toString($tableName);
    }

    public function providerTestEmptyTableName()
    {
        return array(
            'empty table name' => array(''),
            'null table name' => array(null),
        );
    }
}

Fix TableName tests for empty table name


<?php
class Vps_User_Web_Model extends Vps_Model_Db
{
    protected $_table = 'vps_users';
    protected $_referenceMap = array(
        'User' => array(
            'column' => 'id',
            'refModelClass' => 'Vps_User_Model'
        )
    );
    protected $_default = array('role' => 'guest');
}

<?php
class Vps_User_Web_Model extends Vps_Model_Db
{
    protected $_table = 'vps_users';
    protected $_referenceMap = array(
        'User' => array(
            'column' => 'id',
            'refModelClass' => ''
        )
    );
    protected $_default = array('role' => 'guest');

    protected function _init()
    {
        $userModelClass = get_class(Vps_Registry::get('userModel'));
        $this->_referenceMap['User']['refModelClass']  = $userModelClass;
        parent::_init();
    }
}

Fix bei vps_users model, reference ist immer das in der config eingestellte model


<?php

/**
 * Copyright 2016 SURFnet B.V.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Surfnet\StepupMiddleware\CommandHandlingBundle\Configuration\Command;

use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\AbstractCommand;
use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\ManagementExecutable;
use Symfony\Component\Validator\Constraints as Assert;

final class ReconfigureInstitutionConfigurationOptionsCommand extends AbstractCommand implements ManagementExecutable
{
    /**
     * @Assert\NotBlank()
     * @Assert\Type(type="string")
     *
     * @var string
     */
    public $institution;

    /**
     * @Assert\Type(type="boolean")
     *
     * @var bool
     */
    public $useRaLocationsOption;

    /**
     * @Assert\Type(type="boolean")
     *
     * @var bool
     */
    public $showRaaContactInformationOption;
}

<?php

/**
 * Copyright 2016 SURFnet B.V.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Surfnet\StepupMiddleware\CommandHandlingBundle\Configuration\Command;

use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\AbstractCommand;
use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\ManagementExecutable;
use Symfony\Component\Validator\Constraints as Assert;

final class ReconfigureInstitutionConfigurationOptionsCommand extends AbstractCommand implements ManagementExecutable
{
    /**
     * @Assert\NotBlank()
     * @Assert\Type(type="string")
     *
     * @var string
     */
    public $institution;

    /**
     * @Assert\Type(type="boolean")
     *
     * @var bool
     */
    public $useRaLocationsOption;

    /**
     * @Assert\Type(type="boolean")
     *
     * @var bool
     */
    public $showRaaContactInformationOption;

    /**
     * @Assert\All({
     *     @Assert\Choice(
     *         callback={"Surfnet\StepupBundle\Value\SecondFactorType", "getAvailableSecondFactorTypes"},
     *         message="may only contain supported second factor types"
     *     )
     * })
     */
    public $allowedSecondFactors;
}

Add allowedSecondFactors to reconfigure inst conf command


<?php

namespace Spatie\Activitylog;

use Illuminate\Config\Repository;

class ActivityLogStatus
{
    protected $enabled = true;

    public function __construct(Repository $config)
    {
        $this->enabled = $config['activitylog.enabled'];
    }

    public function enable(): bool
    {
        return $this->enabled = true;
    }

    public function disable(): bool
    {
        return $this->enabled = false;
    }

    public function disabled(): bool
    {
        return $this->enabled === false;
    }
}

<?php

namespace Spatie\Activitylog;

use Illuminate\Contracts\Config\Repository;

class ActivityLogStatus
{
    protected $enabled = true;

    public function __construct(Repository $config)
    {
        $this->enabled = $config['activitylog.enabled'];
    }

    public function enable(): bool
    {
        return $this->enabled = true;
    }

    public function disable(): bool
    {
        return $this->enabled = false;
    }

    public function disabled(): bool
    {
        return $this->enabled === false;
    }
}

Use config contract instead of actual implementation.

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php
namespace Composer\Installers;

class KirbyInstaller extends BaseInstaller
{
    protected $locations = array(
        'plugin'    => 'site/plugins/{$name}/',
    );
}

<?php
namespace Composer\Installers;

class KirbyInstaller extends BaseInstaller
{
    protected $locations = array(
        'plugin'    => 'site/plugins/{$name}/',
        'field'    => 'site/fields/{$name}/',
        'tag'    => 'site/tags/{$name}/'
    );
}

Add field and tag types

Add field and tag types


<?php

namespace SoapBox\SignedRequests\Exceptions;

use Exception;
use Throwable;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

class ExpiredRequestException extends Exception implements HttpExceptionInterface
{
    /**
     * The default exception message.
     *
     * @var string
     */
    const MESSAGE = 'The provided request has expired';

    /**
     * Provides a default error message for an invalid signature.
     *
     * @param string $message
     *        A customizable error message.
     */
    public function __construct(string $message = self::MESSAGE)
    {
        parent::__construct($message);
    }

    /**
     * Returns an HTTP BAD REQUEST status code.
     *
     * @return int
     *         An HTTP BAD REQUEST response status code
     */
    public function getStatusCode()
    {
        return Response::HTTP_BAD_REQUEST;
    }

    /**
     * Returns response headers.
     *
     * @return array
     *         Response headers
     */
    public function getHeaders()
    {
        return [];
    }
}

<?php

namespace SoapBox\SignedRequests\Exceptions;

use Exception;
use Throwable;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

class ExpiredRequestException extends Exception implements HttpExceptionInterface
{
    /**
     * The default exception message.
     *
     * @var string
     */
    const MESSAGE = 'The provided request has expired';

    /**
     * Provides a default error message for an expired request.
     *
     * @param string $message
     *        A customizable error message.
     */
    public function __construct(string $message = self::MESSAGE)
    {
        parent::__construct($message);
    }

    /**
     * Returns an HTTP BAD REQUEST status code.
     *
     * @return int
     *         An HTTP BAD REQUEST response status code
     */
    public function getStatusCode()
    {
        return Response::HTTP_BAD_REQUEST;
    }

    /**
     * Returns response headers.
     *
     * @return array
     *         Response headers
     */
    public function getHeaders()
    {
        return [];
    }
}

Update docblock for Expired Request Exception


<?php
namespace LanguageSwitcher\View\Helper;

use Cake\Core\Configure;
use Cake\Core\InstanceConfigTrait;
use Cake\Routing\Router;
use Cake\Utility\Hash;
use Cake\Utility\Text;
use Cake\View\Helper;
use Cake\View\View;

/**
 * LanguageSwitcher helper
 */
class LanguageSwitcherHelper extends Helper
{

    use InstanceConfigTrait;

    protected $_defaultConfig = [
        'availableLanguages' => [
            'en_US' => 'en_US'
        ],
        'displayNames' => [
            'en_US' => 'English'
        ],
        'imageMapping' => [
            'en_US' => 'United-States'
        ]
    ];

    /**
     * Renders language switcher dropdown
     *
     * @return element
     */
    public function renderLanguageSwitcher()
    {
        return $this->_View->element('LanguageSwitcher.language_switcher', [
            'availableLanguages' => $this->config('availableLanguages'),
            'displayNames' => $this->config('displayNames'),
            'imageMapping' => $this->config('imageMapping')
        ]);
    }

    /**
     * Merge current GET parameters with the language string
     *
     * @param string $language Language
     * @return string Url
     */
    public function getUrl($language)
    {
        $lang = ['lang' => $language];
        $query = Hash::merge($lang, $this->request->query);
        $urlArray = Hash::merge($this->request->params['pass'], ['?' => $query]);

        return Router::url($urlArray);
    }
}

<?php
namespace LanguageSwitcher\View\Helper;

use Cake\Core\Configure;
use Cake\Core\InstanceConfigTrait;
use Cake\Routing\Router;
use Cake\Utility\Hash;
use Cake\Utility\Text;
use Cake\View\Helper;
use Cake\View\View;

/**
 * LanguageSwitcher helper
 */
class LanguageSwitcherHelper extends Helper
{

    use InstanceConfigTrait;

    protected $_defaultConfig = [
        'availableLanguages' => [
            'en_US' => 'en_US'
        ],
        'displayNames' => [
            'en_US' => 'English'
        ],
        'imageMapping' => [
            'en_US' => 'United-States'
        ]
    ];

    /**
     * Renders language switcher dropdown
     *
     * @return element
     */
    public function renderLanguageSwitcher()
    {
        return $this->_View->element('LanguageSwitcher.language_switcher', [
            'availableLanguages' => $this->config('availableLanguages'),
            'displayNames' => $this->config('displayNames'),
            'imageMapping' => $this->config('imageMapping')
        ]);
    }

    /**
     * Merge current GET parameters with the language string
     *
     * @param string $language Language
     * @return string Url
     */
    public function getUrl($language)
    {
        $lang = ['lang' => $language];
        $query = Hash::merge($this->request->query, $lang);
        $urlArray = Hash::merge($this->request->params['pass'], ['?' => $query]);

        return Router::url($urlArray);
    }
}

Fix urls of switcher after first switch

Fix urls of switcher after first switch


<?php

namespace JsonLd\ContextTypes;

class Organization extends Thing
{
    /**
     * Property structure
     *
     * @var array
     */
    private $extendedStructure = [
        'address' => PostalAddress::class,
        'logo' => ImageObject::class,
        'contactPoint' => ContactPoint::class,
        'email' => null,
    ];

    /**
     * Organization constructor. Merges extendedStructure up
     *
     * @param array $attributes
     * @param array $extendedStructure
     */
    public function __construct(array $attributes, array $extendedStructure = [])
    {
        parent::__construct(
            $attributes, array_merge($this->structure, $this->extendedStructure, $extendedStructure)
        );
    }

    /**
     * Set the contactPoints
     *
     * @param array $items
     *
     * @return array
     */
    protected function setContactPointAttribute($items)
    {
        if (is_array($items) === false) {
            return $items;
        }

        //Check if it is an array with one dimension
        if (is_array(reset($items)) === false) {
            return $this->getNestedContext(ContactPoint::class, $items);
        }

        //Process multi dimensional array
        return array_map(function ($item) {
            return $this->getNestedContext(ContactPoint::class, $item);
        }, $items);
    }
}

<?php

namespace JsonLd\ContextTypes;

class Organization extends Thing
{
    /**
     * Property structure
     *
     * @var array
     */
    private $extendedStructure = [
        'address' => PostalAddress::class,
        'logo' => ImageObject::class,
        'contactPoint' => ContactPoint::class,
        'email' => null,
        'telephone' => null,
    ];

    /**
     * Organization constructor. Merges extendedStructure up
     *
     * @param array $attributes
     * @param array $extendedStructure
     */
    public function __construct(array $attributes, array $extendedStructure = [])
    {
        parent::__construct(
            $attributes, array_merge($this->structure, $this->extendedStructure, $extendedStructure)
        );
    }

    /**
     * Set the contactPoints
     *
     * @param array $items
     *
     * @return array
     */
    protected function setContactPointAttribute($items)
    {
        if (is_array($items) === false) {
            return $items;
        }

        //Check if it is an array with one dimension
        if (is_array(reset($items)) === false) {
            return $this->getNestedContext(ContactPoint::class, $items);
        }

        //Process multi dimensional array
        return array_map(function ($item) {
            return $this->getNestedContext(ContactPoint::class, $item);
        }, $items);
    }
}

Add telephone property to organization type


<?php

namespace Afup\Bundle\MemberBundle\Tests\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;

use Nelmio\Alice\Fixtures;

class FixturesLoader implements FixtureInterface
{
    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        Fixtures::load(
            array(
                __DIR__ . '/../Resources/fixtures/users.yml',
            ),
            $manager
        );
    }
}

<?php

namespace Afup\Bundle\MemberBundle\Tests\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;

use Nelmio\Alice\Fixtures;

class FixturesLoader implements FixtureInterface
{
    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        Fixtures::load(
            array(
                __DIR__ . '/../../Resources/fixtures/users.yml',
            ),
            $manager
        );
    }
}

Move development fixtures to Tests directory


<?php
class BoardInfoController extends Controller {

	public function execute($request) {
		try {
			parent::execute($request);

			$id = $request[1];
			$boardinfo = new InformationAccess();

			if ($id != null && is_numeric($id)) {
				$oneBoardInfo = $boardinfo->getBoardInfoById($id);
				$_REQUEST["boardInfo"] = serialize($oneBoardInfo);

				// Update read count
				if($_SESSION["read"] <> "paitsio#".$id) {
					$readCount = $boardinfo->updatePaitsioReadCount($id);
					$_SESSION["read"] = "paitsio#".$id;
				}
			} else {
				$allBoardInfos = $boardinfo->getAllBoardInfos();
				$_REQUEST["allBoardInfos"] = serialize($allBoardInfos);
			}

			$return = "boardInfoPage";
		} catch (Exception $e) {
			throw $e;
		}
		return $return;
	}

}
?>

<?php
class BoardInfoController extends Controller {

	public function execute($request) {
		try {
			parent::execute($request);

			$id = $request[1];
			$boardinfo = new InformationAccess();

			if ($id != null && is_numeric($id)) {
				$oneBoardInfo = $boardinfo->getBoardInfoById($id);
				$_REQUEST["boardInfo"] = serialize($oneBoardInfo);

				// Update read count
				if(@$_SESSION["read"] <> "paitsio#".$id) {
					$readCount = $boardinfo->updatePaitsioReadCount($id);
					$_SESSION["read"] = "paitsio#".$id;
				}
			} else {
				$allBoardInfos = $boardinfo->getAllBoardInfos();
				$_REQUEST["allBoardInfos"] = serialize($allBoardInfos);
			}

			$return = "boardInfoPage";
		} catch (Exception $e) {
			throw $e;
		}
		return $return;
	}

}
?>

Repair php's giving error from BoradInfoController


<?php

	@ini_set('display_errors', 'off');

	define('DOCROOT', rtrim(realpath(dirname(__FILE__) . '/../../../'), '/'));
	define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '/') . str_replace('/extensions/less_compiler/lib', NULL, dirname($_SERVER['PHP_SELF'])), '/'));

	// Include some parts of the engine
	require_once(DOCROOT . '/symphony/lib/boot/bundle.php');
	require_once('dist/lessc.inc.php');

	function processParams($string){
		$param = (object)array(
			'file' => 0
		);

		if(preg_match_all('/^(.+)$/i', $string, $matches, PREG_SET_ORDER)){
			$param->file = $matches[0][1];
		}

		return $param;
	}

	$param = processParams($_GET['param']);

	header('Content-type: text/css');

	$lc = new lessc(WORKSPACE . '/' . $param->file);
	echo $lc->parse();

	exit;

<?php

	@ini_set('display_errors', 'off');

	define('DOCROOT', rtrim(realpath(dirname(__FILE__) . '/../../../'), '/'));
	define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '/') . str_replace('/extensions/less_compiler/lib', NULL, dirname($_SERVER['PHP_SELF'])), '/'));

	// Include some parts of the engine
	require_once(DOCROOT . '/symphony/lib/boot/bundle.php');
	require_once(CONFIG);
	require_once('dist/lessc.inc.php');

	function processParams($string){
		$param = (object)array(
			'file' => 0
		);

		if(preg_match_all('/^(.+)$/i', $string, $matches, PREG_SET_ORDER)){
			$param->file = $matches[0][1];
		}

		return $param;
	}

	$param = processParams($_GET['param']);

	header('Content-type: text/css');

	$lc = new lessc(WORKSPACE . '/' . $param->file);
	echo $lc->parse();

	exit;

Read config, in preparation for configurable behaviour


<?php

/**
 * Implements convenient methods for conversion of JSON to and from WKT.
 */

function json_to_wkt($json) {
    $geometry = json_decode($json)->{"features"}[0]->{"geometry"};
    $coordinates = $geometry->{"coordinates"};
    $wkt = "";

    if($geometry->{"type"} == "Polygon") {
        $wkt = "POLYGON(";
        foreach ($coordinates as $linearRing) {
            $wkt .= "(";
            foreach($linearRing as $point) {
                $wkt .= $point[0] . " " . $point[1] . ",";
            }
            $wkt = substr($wkt, 0, -1) . "),";
        }
    } else if($geometry->{"type"} == "MultiPolygon") {
        $wkt = "MULTIPOLYGON(";
        foreach ($coordinates as $polygon) {
            $wkt .= "(";
            foreach ($polygon as $linearRing) {
                $wkt .= "(";
                foreach ($linearRing as $point) {
                    $wkt .= $point[0] . " " . $point[1] . ",";
                }
                $wkt = substr($wkt, 0, -1) . "),";
            }
            $wkt = substr($wkt, 0, -1) . "),";
        }
    }

    return substr($wkt, 0, -1) . ")";
}

?>

<?php

/**
 * Implements convenient methods for conversion of JSON and WKT.
 */

function json_to_wkt($json) {
    $geometry = json_decode($json)->{"features"}[0]->{"geometry"};
    $coordinates = $geometry->{"coordinates"};
    $wkt = "";

    if($geometry->{"type"} == "Polygon") {
        $wkt = "POLYGON(";
        foreach ($coordinates as $linearRing) {
            $wkt .= "(";
            foreach($linearRing as $point) {
                $wkt .= $point[0] . " " . $point[1] . ",";
            }
            $wkt = substr($wkt, 0, -1) . "),";
        }
    } else if($geometry->{"type"} == "MultiPolygon") {
        $wkt = "MULTIPOLYGON(";
        foreach ($coordinates as $polygon) {
            $wkt .= "(";
            foreach ($polygon as $linearRing) {
                $wkt .= "(";
                foreach ($linearRing as $point) {
                    $wkt .= $point[0] . " " . $point[1] . ",";
                }
                $wkt = substr($wkt, 0, -1) . "),";
            }
            $wkt = substr($wkt, 0, -1) . "),";
        }
    }

    return substr($wkt, 0, -1) . ")";
}

function point_to_coord($wkt) {
    $coord = explode("(", $wkt)[1];
    $coord = explode(")", $coord)[0];

    return explode(" ", $coord);
}

?>

Add function to convert wkt point to coordinates.


<?php

/*
	Plugin Name: WordPress Sentry
	Plugin URI: https://github.com/stayallive/wp-sentry
	Description: A (unofficial) WordPress plugin to report PHP errors and JavaScript errors to Sentry.
	Version: 1.0
	Author: Alex Bouma
	Author URI: https://alex.bouma.me
	License: MIT
*/

// Define the base directory for easy access to any libs
define( 'WP_SENTRY_DIR', __DIR__ );

// Define the application version
define( 'WP_SENTRY_VERSION', ( defined( 'WP_SENTRY_VERSION' ) ) ? WP_SENTRY_VERION : wp_get_theme()->get( 'Version' ) );

// Load the PHP tracker if we have a private DSN
if ( defined( 'WP_SENTRY_DSN' ) && ! empty( WP_SENTRY_DSN ) ) {
	require_once __DIR__ . '/trackers/php/tracker.php';
}

// Load the JS tracker if we have a public DSN
if ( defined( 'WP_SENTRY_PUBLIC_DSN' ) || ! empty( WP_SENTRY_PUBLIC_DSN ) ) {
	require_once __DIR__ . '/trackers/js/tracker.php';
}

<?php

/*
	Plugin Name: WordPress Sentry
	Plugin URI: https://github.com/stayallive/wp-sentry
	Description: A (unofficial) WordPress plugin to report PHP errors and JavaScript errors to Sentry.
	Version: 1.0
	Author: Alex Bouma
	Author URI: https://alex.bouma.me
	License: MIT
*/

// Define the base directory for easy access to any libs
define( 'WP_SENTRY_DIR', __DIR__ );

// Define the application version
if ( ! defined( 'WP_SENTRY_VERSION' ) ) {
	define( 'WP_SENTRY_VERSION', wp_get_theme()->get( 'Version' ) );
}

// Load the PHP tracker if we have a private DSN
if ( defined( 'WP_SENTRY_DSN' ) && ! empty( WP_SENTRY_DSN ) ) {
	require_once __DIR__ . '/trackers/php/tracker.php';
}

// Load the JS tracker if we have a public DSN
if ( defined( 'WP_SENTRY_PUBLIC_DSN' ) || ! empty( WP_SENTRY_PUBLIC_DSN ) ) {
	require_once __DIR__ . '/trackers/js/tracker.php';
}

Fix WP_SENTRY_VERSION already defined error


<?php

namespace ModuleGenerator\CLI\Console\Generate\Domain;

use ModuleGenerator\CLI\Console\GenerateCommand;
use ModuleGenerator\Domain\Repository\Repository as RepositoryClass;
use ModuleGenerator\Domain\Repository\RepositoryType;
use ModuleGenerator\Module\Backend\Resources\Config\Repositories\Repositories;
use ModuleGenerator\PhpGenerator\ClassName\ClassName;
use ModuleGenerator\PhpGenerator\ModuleName\ModuleName;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class Repository extends GenerateCommand
{
    protected function configure()
    {
        parent::configure();

        $this->setName('generate:domain:repository')
            ->setDescription('Generates the repository class for an entity');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $entityClassName = ClassName::fromDataTransferObject($this->getFormData(RepositoryType::class));
        $repositoryClass = RepositoryClass::fromEntityClassName($entityClassName);
        $this->generateService->generateClass(
            $repositoryClass,
            $this->getTargetPhpVersion()
        );

        $moduleName = $this->extractModuleName($repositoryClass->getClassName()->getNamespace());
        if ($moduleName instanceof ModuleName) {
            $this->generateService->generateFile(
                new Repositories(
                    $moduleName,
                    [$repositoryClass->getClassName()->getForUseStatement()],
                    true
                ),
                $this->getTargetPhpVersion()
            );
        }
    }
}

<?php

namespace ModuleGenerator\CLI\Console\Generate\Domain;

use ModuleGenerator\CLI\Console\GenerateCommand;
use ModuleGenerator\Domain\Repository\Repository as RepositoryClass;
use ModuleGenerator\Domain\Repository\RepositoryType;
use ModuleGenerator\Module\Backend\Resources\Config\Repositories\Repositories;
use ModuleGenerator\PhpGenerator\ClassName\ClassName;
use ModuleGenerator\PhpGenerator\ModuleName\ModuleName;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class Repository extends GenerateCommand
{
    protected function configure()
    {
        parent::configure();

        $this->setName('generate:domain:repository')
            ->setDescription('Generates the repository class for an entity');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $this->createRepository(ClassName::fromDataTransferObject($this->getFormData(RepositoryType::class)));
    }

    public function createRepository(ClassName $entityClassName): void
    {
        $repositoryClass = RepositoryClass::fromEntityClassName($entityClassName);
        $this->generateService->generateClass(
            $repositoryClass,
            $this->getTargetPhpVersion()
        );

        $moduleName = $this->extractModuleName($repositoryClass->getClassName()->getNamespace());
        if ($moduleName instanceof ModuleName) {
            $this->generateService->generateFile(
                new Repositories(
                    $moduleName,
                    [$repositoryClass->getClassName()->getForUseStatement()],
                    true
                ),
                $this->getTargetPhpVersion()
            );
        }
    }
}

Refactor the repository generator so we can reuse its methods


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Form\Extension\Core\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;

class RepeatedType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilder $builder, array $options)
    {
        $builder
            ->appendClientTransformer(new ValueToDuplicatesTransformer(array(
                $options['first_name'],
                $options['second_name'],
            )))
            ->add($options['first_name'], $options['type'], $options['options'])
            ->add($options['second_name'], $options['type'], $options['options'])
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function getDefaultOptions(array $options)
    {
        return array(
            'type'              => 'text',
            'options'           => array(),
            'first_name'        => 'first',
            'second_name'       => 'second',
            'error_bubbling'    => false,
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'repeated';
    }
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Form\Extension\Core\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;

class RepeatedType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilder $builder, array $options)
    {
        $builder
            ->appendClientTransformer(new ValueToDuplicatesTransformer(array(
                $options['first_name'],
                $options['second_name'],
            )))
            ->add($options['first_name'],  $options['type'], 0 < count($options['first_options'])  ? $options['first_options']  : $options['options'])
            ->add($options['second_name'], $options['type'], 0 < count($options['second_options']) ? $options['second_options'] : $options['options'])

        ;
    }

    /**
     * {@inheritdoc}
     */
    public function getDefaultOptions(array $options)
    {
        return array(
            'type'           => 'text',
            'options'        => array(),
            'first_options'  => array(),
            'second_options' => array(),
            'first_name'     => 'first',
            'second_name'    => 'second',
            'error_bubbling' => false,
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'repeated';
    }
}

[Form] Allow setting different options to repeating fields


<?php

namespace Korobi\WebBundle\Repository;

use Doctrine\ODM\MongoDB\DocumentRepository;

class ChannelConfigRepository extends DocumentRepository {

}

<?php

namespace Korobi\WebBundle\Repository;

use Doctrine\ODM\MongoDB\DocumentRepository;

class ChannelRepository extends DocumentRepository {

    /**
     * @param $network
     * @return mixed
     */
    public function findAllByNetwork($network) {
        return $this->createQueryBuilder()
            ->sort('name', 'ASC')
            ->field('network')->equals($network)
            ->getQuery()
            ->execute();
    }
}

Fix repository name, add helper funcion

Fix repository name, add helper funcion


<?php
if (!defined('PHPUnit2_MAIN_METHOD')) {
    define('PHPUnit2_MAIN_METHOD', 'AllTests::main');
}

require_once 'PHPUnit2/Framework/TestSuite.php';
require_once 'PHPUnit2/TextUI/TestRunner.php';

/**
 * Read in user-defined test configuration if available; otherwise, read default test configuration
 */
if (is_readable('TestConfiguration.php')) {
    require_once 'TestConfiguration.php';
} else {
    require_once 'TestConfiguration.php.dist';
}

/**
 * Append library/ to the include_path.  This allows the tests to run out of the box and
 * helps prevent finding other copies of the framework that might be present.
 */
set_include_path(get_include_path() . PATH_SEPARATOR
                 . dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'library');

require_once 'ZendTest.php';
require_once 'Zend/AllTests.php';

class AllTests
{
    public static function main()
    {
        PHPUnit2_TextUI_TestRunner::run(self::suite());
    }

    public static function suite()
    {
        $suite = new PHPUnit2_Framework_TestSuite('Zend Framework');

        $suite->addTestSuite('ZendTest');

        $suite->addTest(Zend_AllTests::suite());

        return $suite;
    }
}

if (PHPUnit2_MAIN_METHOD == 'AllTests::main') {
    AllTests::main();
}

<?php
if (!defined('PHPUnit2_MAIN_METHOD')) {
    define('PHPUnit2_MAIN_METHOD', 'AllTests::main');
}

require_once 'PHPUnit2/Framework/TestSuite.php';
require_once 'PHPUnit2/TextUI/TestRunner.php';

/**
 * Read in user-defined test configuration if available; otherwise, read default test configuration
 */
if (is_readable('TestConfiguration.php')) {
    require_once 'TestConfiguration.php';
} else {
    require_once 'TestConfiguration.php.dist';
}

/**
 * Prepend library/ to the include_path.  This allows the tests to run out of the box and
 * helps prevent finding other copies of the framework that might be present.
 */
set_include_path(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'library'
                 . PATH_SEPARATOR . get_include_path());

require_once 'ZendTest.php';
require_once 'Zend/AllTests.php';

class AllTests
{
    public static function main()
    {
        PHPUnit2_TextUI_TestRunner::run(self::suite());
    }

    public static function suite()
    {
        $suite = new PHPUnit2_Framework_TestSuite('Zend Framework');

        $suite->addTestSuite('ZendTest');

        $suite->addTest(Zend_AllTests::suite());

        return $suite;
    }
}

if (PHPUnit2_MAIN_METHOD == 'AllTests::main') {
    AllTests::main();
}

Prepend library/ to the include_path to help prevent testing other copies of the framework.

git-svn-id: b6e219894c353fb1d215c78b2075057d8daadfba@604 44c647ce-9c0f-0410-b52a-842ac1e357ba


<?php

namespace App\Service;

use App\Normalizer\DTO;
use App\Normalizer\Entity;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Serializer;

/**
 * Class SerializerFactory
 * Ensures that we only serialize the things we want to
 * and don't fall back to any defaults.
 *
 */
class SerializerFactory
{
    /**
     * Build our own serializer just the way we like it
     * @param Entity $entityNormalizer
     * @param DTO $dtoNormalizer
     * @return Serializer
     */
    public static function createSerializer(Entity $entityNormalizer, DTO $dtoNormalizer)
    {
        $jsonEncoder = new JsonEncoder();
        $array = new ArrayDenormalizer();
        $dateTime = new DateTimeNormalizer();
        $processors = [$array, $dateTime, $jsonEncoder, $entityNormalizer, $dtoNormalizer];
        return new Serializer($processors, $processors);
    }
}

<?php

namespace App\Service;

use App\Normalizer\DTO;
use App\Normalizer\Entity;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Serializer;

/**
 * Class SerializerFactory
 * Ensures that we only serialize the things we want to
 * and don't fall back to any defaults.
 *
 */
class SerializerFactory
{
    /**
     * Build our own serializer just the way we like it
     * @param Entity $entityNormalizer
     * @param DTO $dtoNormalizer
     * @return Serializer
     */
    public static function createSerializer(Entity $entityNormalizer, DTO $dtoNormalizer)
    {
        $jsonEncoder = new JsonEncoder();
        $array = new ArrayDenormalizer();
        $dateTime = new DateTimeNormalizer();
        return new Serializer([$array, $dateTime, $entityNormalizer, $dtoNormalizer], [$jsonEncoder]);
    }
}

Clean up what we pass to the serializer

Clean up what we pass to the serializer

Normalizers and encoders are different and should be passed in their own
blocks. Symfony 4.2 deprecated passing both together.


<?php
class Kwc_Abstract_Composite_Cc_Component extends Kwc_Chained_Cc_Component
{
    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();
        foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
            if ($ret[$c->id]) $ret[$c->id] = $c; // Bei TextImage kann zB. Bild ausgeblendet werden und soll dann in Übersetzung auch nicht angezeigt werden
        }
        return $ret;
    }

    public function hasContent()
    {
        foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
            if ($c->hasContent()) return true;
        }
        return false;
    }
}

<?php
class Kwc_Abstract_Composite_Cc_Component extends Kwc_Chained_Cc_Component
{
    public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer = null)
    {
        $ret = parent::getTemplateVars($renderer);
        foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
            if ($ret[$c->id]) $ret[$c->id] = $c; // Bei TextImage kann zB. Bild ausgeblendet werden und soll dann in Übersetzung auch nicht angezeigt werden
        }
        return $ret;
    }

    public function hasContent()
    {
        foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
            if ($c->hasContent()) return true;
        }
        return false;
    }
}

Add renderer for Composite_Cc getTemplateVars

fixes Cc html component (which needs renderer)


<?php

/**
 * @package interface
 */
/**
 * This interface is to be implemented by Extensions who wish to provide
 * objects for Symphony to use.
 *
 * @since Symphony 2.3.1
 */
interface iProvider
{
    const DATASOURCE = 'data-sources';
    const EVENT = 'events';

    /**
     * This function should return an associative array of all the
     * Providable objects this extension provides.
     *
     * @since Symphony 2.3
     * @param string $type
     *  The type of provider object to return, which is one of the `iProvider`
     *  constants. If `$type` is given, this function should
     *  only return objects of this `$type`, otherwise all providable objects
     *  should be returned.
     * @return array
     *  If no providers are found, then an empty array is returned, otherwise
     *  an associative array of classname => human name will be returned.
     *  eg. `array('RemoteDatasource' => 'Remote Datasource')`
     */
    public static function providerOf($type = null);
}

<?php

/**
 * @package interface
 */
/**
 * This interface is to be implemented by Extensions who wish to provide
 * objects for Symphony to use.
 *
 * @since Symphony 2.3.1
 */
interface iProvider
{
    const DATASOURCE = 'data-sources';
    const EVENT = 'events';
    const CACHE = 'cache';

    /**
     * This function should return an associative array of all the
     * Providable objects this extension provides.
     *
     * @since Symphony 2.3
     * @param string $type
     *  The type of provider object to return, which is one of the `iProvider`
     *  constants. If `$type` is given, this function should
     *  only return objects of this `$type`, otherwise all providable objects
     *  should be returned.
     * @return array
     *  If no providers are found, then an empty array is returned, otherwise
     *  an associative array of classname => human name will be returned.
     *  eg. `array('RemoteDatasource' => 'Remote Datasource')`
     */
    public static function providerOf($type = null);
}

Add CACHE constant to Provider interface


<?php
function startsWith($haystack, $needle)
{
     $length = strlen($needle);
     return (substr($haystack, 0, $length) === $needle);
}

$c = new Memcached();
$c->addServer("localhost", 11211);
foreach($c->getAllKeys() as $key) {
	if(startsWith($key, "qreport_")) {
		$time_start = microtime(true);
		$query = substr($key, strlen("qreport_")) ;
		echo "====== QUERY  $query ======\n";

		echo file_get_contents("http://builder.osmand.net/reports/query_report?".$query."&force=true";
		$time_end = microtime(true);
		$time = $time_end - $time_start;

		echo "\n====== DONE $time seconds ======\n";
	}

}
// var_dump( $c->getAllKeys() );
?>

<?php
function startsWith($haystack, $needle)
{
     $length = strlen($needle);
     return (substr($haystack, 0, $length) === $needle);
}

$c = new Memcached();
$c->addServer("localhost", 11211);
foreach($c->getAllKeys() as $key) {
	if(startsWith($key, "qreport_")) {
		$time_start = microtime(true);
		$query = substr($key, strlen("qreport_")) ;
		echo "====== QUERY  $query ======\n";

		echo file_get_contents("http://builder.osmand.net/reports/query_report?".$query."&force=true");
		$time_end = microtime(true);
		$time = $time_end - $time_start;

		echo "\n====== DONE $time seconds ======\n";
	}

}
// var_dump( $c->getAllKeys() );
?>

Update server site for osmlive reports

Update server site for osmlive reports


<?php

namespace Nin\Renderers;

use Nin\Renderer;

class PhpRenderer extends Renderer
{
	protected $controller;

	public function __construct($controller)
	{
		$this->controller = $controller;
	}

	public function render($inc_path, $options)
	{
		$func = function($inc_path, $options) {
			extract($options);
			include($inc_path);
		};
		$func->bindTo($this->controller, $this->controller);
		$func($inc_path, $options);
	}
}

<?php

namespace Nin\Renderers;

use Nin\Renderer;

class PhpRenderer extends Renderer
{
	protected $controller;

	public function __construct($controller)
	{
		$this->controller = $controller;
	}

	public function render($inc_path, $options)
	{
		$func = function($inc_path, $options) {
			extract($options);
			include($inc_path);
		};
		$func->call($this->controller, $inc_path, $options);
	}
}

Fix php renderer binding not working

Fix php renderer binding not working


<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Sylius\Component\Promotion\Event;

final class CatalogPromotionUpdated
{
    public string $code;

    public function __construct(string $code)
    {
        $this->code = $code;
    }
}

<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Sylius\Component\Promotion\Event;

class CatalogPromotionUpdated
{
    public string $code;

    public function __construct(string $code)
    {
        $this->code = $code;
    }
}

[CatalogPromotion] Remove final from catalog promotion updated event


<?php

use Sami\Sami;
use Sami\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;

$iterator = Finder::create()
    ->files()
    ->name('*.php')
    ->exclude('Resources')
    ->in($dir = 'src');

$versions = GitVersionCollection::create($dir)
    ->add('develop', 'develop branch')
    ->add('master', 'master branch')
    ->addFromTags('*');

return new Sami($iterator, array(
    'theme' => 'enhanced',
    'versions' => $versions,
    'title' => 'AuthBucket\OAuth2 API',
    'build_dir' => __DIR__ . '/build/sami/%version%',
    'cache_dir' => __DIR__ . '/build/cache/sami/%version%',
    'include_parent_data' => false,
    'default_opened_level' => 2,
));

<?php

use Sami\Sami;
use Sami\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;

$iterator = Finder::create()
    ->files()
    ->name('*.php')
    ->exclude('Resources')
    ->in($dir = 'src');

$versions = GitVersionCollection::create($dir)
    ->add('develop', 'develop branch')
    ->add('master', 'master branch')
    ->addFromTags('*');

return new Sami($iterator, array(
    'theme' => 'default',
    'versions' => $versions,
    'title' => 'AuthBucket\OAuth2 API',
    'build_dir' => __DIR__ . '/build/sami/%version%',
    'cache_dir' => __DIR__ . '/build/cache/sami/%version%',
    'include_parent_data' => false,
    'default_opened_level' => 2,
));

Update Sami theme as default.

Update Sami theme as default.


<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;

class Module
{
    public function onBootstrap(MvcEvent $e)
    {
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);

        $sm = $e->getApplication()->getServiceManager();

        // Add ACL information to the Navigation view helper
        $authorize = $sm->get('BjyAuthorize\Service\Authorize');
        \Zend\View\Helper\Navigation::setDefaultAcl($authorize->getAcl());
        \Zend\View\Helper\Navigation::setDefaultRole($authorize->getIdentity());

    }

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }
}

<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;

class Module
{
    public function onBootstrap(MvcEvent $e)
    {
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);

        $sm = $e->getApplication()->getServiceManager();

        // Add ACL information to the Navigation view helper
        $authorize = $sm->get('BjyAuthorize\Service\Authorize');
        try {
            \Zend\View\Helper\Navigation::setDefaultAcl($authorize->getAcl());
            \Zend\View\Helper\Navigation::setDefaultRole($authorize->getIdentity());
        } catch (\Doctrine\DBAL\DBALException $exception) {
            // database tables not yet initialized
        }

    }

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }
}

Fix navigation ACL issue when db is not initialized


<?php
/**
 * WHIP libary file.
 *
 * @package Yoast\WHIP
 */

/**
 * Class Whip_HostMessage.
 */
class Whip_HostMessage implements Whip_Message {

	/**
	 * @var string
	 */
	private $textdomain;

	/**
	 * @var string
	 */
	private $messageKey;

	/**
	 * @var string
	 */
	private $filterKey;

	/**
	 * Whip_Message constructor.
	 *
	 * @param string $messageKey The environment key to use to retrieve the message from.
	 * @param string $textdomain The text domain to use for translations.
	 */
	public function __construct( $messageKey, $textdomain ) {
		$this->textdomain = $textdomain;
		$this->messageKey = $messageKey;
	}

	/**
	 * Renders the message body.
	 *
	 * @return string The message body.
	 */
	public function body() {
		$message = array();

		$message[] = Whip_MessageFormatter::strong( $this->title() ) . '<br />';
		$message[] = Whip_MessageFormatter::paragraph( Whip_Host::message( $this->messageKey, $this->filterKey ) );

		return implode( $message, "\n" );
	}

	/**
	 * Renders the message title.
	 *
	 * @return string The message title.
	 */
	public function title() {
		return sprintf( __( 'A message from %1$s', $this->textdomain ), Whip_Host::name() );
	}
}

<?php
/**
 * WHIP libary file.
 *
 * @package Yoast\WHIP
 */

/**
 * Class Whip_HostMessage.
 */
class Whip_HostMessage implements Whip_Message {

	/**
	 * @var string
	 */
	private $textdomain;

	/**
	 * @var string
	 */
	private $messageKey;

	/**
	 * Whip_Message constructor.
	 *
	 * @param string $messageKey The environment key to use to retrieve the message from.
	 * @param string $textdomain The text domain to use for translations.
	 */
	public function __construct( $messageKey, $textdomain ) {
		$this->textdomain = $textdomain;
		$this->messageKey = $messageKey;
	}

	/**
	 * Renders the message body.
	 *
	 * @return string The message body.
	 */
	public function body() {
		$message = array();

		$message[] = Whip_MessageFormatter::strong( $this->title() ) . '<br />';
		$message[] = Whip_MessageFormatter::paragraph( Whip_Host::message( $this->messageKey ) );

		return implode( $message, "\n" );
	}

	/**
	 * Renders the message title.
	 *
	 * @return string The message title.
	 */
	public function title() {
		return sprintf( __( 'A message from %1$s', $this->textdomain ), Whip_Host::name() );
	}
}

Clean up: Remove unused property and function call parameter

Introduced in 1058f244fe6b478a26b02bef8100b943a0cb76d7, the implementation was changed in 2c129ef69a3d408973be66ac85309514355e95b4, however, the now superfluous property and function call parameter were not removed.


<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', function()
{
	return View::make('hello');
});

Route::group(array('prefix' => 'api/v1'), function()
{
	Route::resource('team', 'TeamsController', array('except' => array('edit', 'destroy')));
});

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', function()
{
	return View::make('hello');
});

Route::group(array('prefix' => 'api/v1'), function()
{
	Route::resource('teams', 'TeamsController', array('except' => array('edit', 'destroy')));
});

Change team method to teams method for convention consistency


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ChangeDominionsWizardSpyStrengthType extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('dominions', function (Blueprint $table) {
            $table->float('spy_strength')->change();
            $table->float('wizard_strength')->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('dominions', function (Blueprint $table) {
            $table->integer('spy_strength')->unsigned()->change();
            $table->integer('wizard_strength')->unsigned()->change();
        });
    }
}

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ChangeDominionsWizardSpyStrengthType extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('dominions', function (Blueprint $table) {
            $table->float('spy_strength')->change();
            $table->float('wizard_strength')->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('dominions', function (Blueprint $table) {
            $table->unsignedInteger('spy_strength')->change();
            $table->unsignedInteger('wizard_strength')->change();
        });
    }
}

Reorder inputs and use unsignedInteger() in migration


<?php
/**
 * @author Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
 */

namespace RestApp\Api\Controller;

use Exception;
use ReflectionExtension;

/**
 * Class IndexController
 * @Path("/api")
 */
class IndexController extends \Owl\Mvc\Controller
{
    /**
     * @Get
     * @Url("/", name="default")
     */
    public function indexAction()
    {
        return array(
            'info' => array(
                'php' => array(
                    'version' => PHP_VERSION
                ),
                'time' => time()
            )
        );
    }

    /**
     * @Get
     * @Url("/ping", name="api-ping")
     */
    public function pingAction()
    {
        return ['pong'];
    }

    /**
     * @Get
     * @Url("/version", name="api-show-version")
     */
    public function versionAction()
    {
        $ext = new ReflectionExtension('owl');

        return [
            'version' => '0.1-dev',
            'owl' => $ext->getVersion()
        ];
    }

    public function errorAction()
    {
        return array(
            'message' => 'Not found',
            'uri' => $this->request->getUri()
        );
    }

    public function exceptionAction(Exception $e)
    {
        if ($e->getCode() >= 400) {
            $this->response->setCode($e->getCode());
        }

        return array(
            $e->getMessage()
        );
    }
}

<?php
/**
 * @author Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
 */

namespace RestApp\Api\Controller;

use Exception;
use ReflectionExtension;

/**
 * Class IndexController
 * @Path("/api")
 */
class IndexController extends \Owl\Mvc\Controller
{
    /**
     * @Get
     * @Url("/", name="default")
     */
    public function indexAction()
    {
        return array(
            'info' => array(
                'php' => array(
                    'version' => PHP_VERSION
                ),
                'time' => time()
            )
        );
    }

    /**
     * @Get
     * @Url("/ping", name="api-ping")
     */
    public function pingAction()
    {
        return ['pong'];
    }

    /**
     * @Get
     * @Url("/version", name="api-show-version")
     */
    public function versionAction()
    {
        $ext = new ReflectionExtension('owl');

        return [
            'version' => '0.1-dev',
            'owl' => $ext->getVersion()
        ];
    }

    public function errorAction()
    {
        return array(
            'message' => 'Not found',
            'uri' => $this->request->getUri()
        );
    }

    public function exceptionAction(Exception $e)
    {
        if ($e->getCode() >= 400) {
            $this->response->getStatusCode($e->getCode());
        }

        return array(
            $e->getMessage()
        );
    }
}

Fix BC with setCode -> setStatusCode

Fix BC with setCode -> setStatusCode


<?php

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Swagger;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

/** @experimental */
final class ProductDocumentationNormalizer implements NormalizerInterface
{
    /** @var NormalizerInterface */
    private $decoratedNormalizer;

    public function __construct(NormalizerInterface $decoratedNormalizer)
    {
        $this->decoratedNormalizer = $decoratedNormalizer;
    }

    public function supportsNormalization($data, $format = null)
    {
        return $this->decoratedNormalizer->supportsNormalization($data, $format);
    }

    public function normalize($object, $format = null, array $context = [])
    {
        $docs = $this->decoratedNormalizer->normalize($object, $format, $context);

        $defaultVariantSchema = [
            'type' => 'string',
            'format' => 'iri-reference',
            'nullable' => true,
            'readOnly' => true,
        ];

        $docs['components']['schemas']['Product.jsonld-admin.product.read']['properties']['defaultVariant'] = $defaultVariantSchema;
        $docs['components']['schemas']['Product.jsonld-shop.product.read']['properties']['defaultVariant'] = $defaultVariantSchema;

        return $docs;
    }
}

<?php

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Swagger;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

/** @experimental */
final class ProductDocumentationNormalizer implements NormalizerInterface
{
    /** @var NormalizerInterface */
    private $decoratedNormalizer;

    public function __construct(NormalizerInterface $decoratedNormalizer)
    {
        $this->decoratedNormalizer = $decoratedNormalizer;
    }

    public function supportsNormalization($data, $format = null)
    {
        return $this->decoratedNormalizer->supportsNormalization($data, $format);
    }

    public function normalize($object, $format = null, array $context = [])
    {
        $docs = $this->decoratedNormalizer->normalize($object, $format, $context);

        $defaultVariantSchema = [
            'type' => 'string',
            'format' => 'iri-reference',
            'nullable' => true,
            'readOnly' => true,
        ];

        $inStockSchema = [
            'type' => 'boolean',
            'nullable' => false,
            'readOnly' => true,
        ];

        $docs['components']['schemas']['Product.jsonld-admin.product.read']['properties']['defaultVariant'] = $defaultVariantSchema;
        $docs['components']['schemas']['Product.jsonld-shop.product.read']['properties']['defaultVariant'] = $defaultVariantSchema;
        $docs['components']['schemas']['Product.jsonld-shop.product.read']['properties']['inStock'] = $inStockSchema;

        return $docs;
    }
}

Add missing inStock field to swagger

[API] Add missing inStock field to swagger


	<title>
		<?php echo $page_data['title']; ?>
	</title>

Site title

Motto

		<?php echo $page_data['content']; ?>

Footer

<html>
	<head>
		<title>
			<?php echo $page_data['title']; ?>
		</title>
	</head>
	<body>
		<?php echo $page_data['content']; ?>
	</body>
</html>

Fix markup on XHtml Outlet

Fix markup on XHtml Outlet


<?php

namespace UoMCS\OpenBadges\Backend;

class IssuerTest extends \PHPUnit_Framework_TestCase
{
  public function testConstructor()
  {
    $data = array(
      'id' => null,
      'name' => null,
      'url' => null,
      'description' => null,
      'image' => null,
      'email' => null
    );

    $issuer = new Issuer($data);
    $this->assertInstanceOf('UoMCS\OpenBadges\Backend\Issuer', $issuer);
  }

  public function testGetIssuer()
  {
    $id = 1;

    $issuer = Issuer::get($id);
  }

  public function testIssuersUrl()
  {
    $url = WEB_SERVER_BASE_URL . '/issuers';

    $client = new \Zend\Http\Client();
    $client->setUri($url);
    $response = $client->send();

    $this->assertTrue($response->isOk(), 'Accessing /issuers did not return 2xx code');

    $body = $response->getBody();
    $json_body = json_decode($body, true);

    $this->assertNotNull($json_body, 'Body is not valid JSON');
  }
}

<?php

namespace UoMCS\OpenBadges\Backend;

class IssuerTest extends \PHPUnit_Framework_TestCase
{
  public function testIssuersUrl()
  {
    $url = WEB_SERVER_BASE_URL . '/issuers';

    $client = new \Zend\Http\Client();
    $client->setUri($url);
    $response = $client->send();

    $this->assertTrue($response->isOk(), 'Accessing /issuers did not return 2xx code');

    $body = $response->getBody();
    $json_body = json_decode($body, true);

    $this->assertNotNull($json_body, 'Body is not valid JSON');
  }
}

Remove unnecessary issurer test code

Remove unnecessary issurer test code


<?php

namespace F;

function curry($f, array $args)
{
    $meta = new \ReflectionFunction($f);
    return curryN($meta->getNumberOfParameters(), $f, $args);
}

function curryN($arity, $f, array $args)
{
    $accumulate = function (array $appliedArgs, $totalArgsCount) use ($f, $args, &$accumulate)
    {
        if (count($appliedArgs) + count($args) >= $totalArgsCount) {
            return call_user_func_array($f, array_merge($args, $appliedArgs));
        }

        return function ($x) use (&$accumulate, $appliedArgs, $totalArgsCount)
        {
            $append = function ($item, array $list)
            {
                $list[] = $item;
                return $list;
            };

            return $accumulate($append($x, $appliedArgs), $totalArgsCount);
        };
    };

    return $accumulate([], $arity);
}

function compose(array $fs)
{
    return function () use ($fs)
    {
        $args = func_get_args();

        foreach (array_reverse($fs) as $f) {
            $args = [call_user_func_array($f, $args)];
        }

        return $args[0];
    };
}

// prop :: s -> {s: a} -> Maybe a
function prop($name, array $valuesByKey)
{
    return new Maybe(isset($valuesByKey[$name]) ? $valuesByKey[$name] : null);
}

<?php

namespace F;

function curry($f, array $args)
{
    $meta = new \ReflectionFunction($f);
    return curryN($meta->getNumberOfParameters(), $f, $args);
}

function curryN($arity, $f, array $args)
{
    $accumulate = function (array $appliedArgs, $totalArgsCount) use ($f, $args, &$accumulate)
    {
        if (count($appliedArgs) + count($args) >= $totalArgsCount) {
            return call_user_func_array($f, array_merge($args, $appliedArgs));
        }

        return function ($x) use (&$accumulate, $appliedArgs, $totalArgsCount)
        {
            $append = function ($item, array $list)
            {
                $list[] = $item;
                return $list;
            };

            return $accumulate($append($x, $appliedArgs), $totalArgsCount);
        };
    };

    return $accumulate([], $arity);
}

// compose :: ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z)
function compose(array $fs)
{
    return function () use ($fs)
    {
        $args = func_get_args();

        foreach (array_reverse($fs) as $f) {
            $args = [call_user_func_array($f, $args)];
        }

        return $args[0];
    };
}

// prop :: s -> {s: a} -> Maybe a
function prop($name, array $valuesByKey)
{
    return new Maybe(isset($valuesByKey[$name]) ? $valuesByKey[$name] : null);
}

Add the signature for compose()

Add the signature for compose()