<?php

/**
 *    Copyright 2015-2017 ppy Pty. Ltd.
 *
 *    This file is part of osu!web. osu!web is distributed with the hope of
 *    attracting more community contributions to the core ecosystem of osu!.
 *
 *    osu!web is free software: you can redistribute it and/or modify
 *    it under the terms of the Affero GNU General Public License version 3
 *    as published by the Free Software Foundation.
 *
 *    osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
 *    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *    See the GNU Affero General Public License for more details.
 *
 *    You should have received a copy of the GNU Affero General Public License
 *    along with osu!web.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace App\Transformers;

use App\Models\UserBanHistory;
use League\Fractal;

class UserBanHistoryTransformer extends Fractal\TransformerAbstract
{
    protected $availableIncludes = [
        'banner',
    ];

    public function transform(UserBanHistory $bh)
    {
        return [
            'reason' => $bh->reason,
            'type' => $bh->ban_status,
            'timestamp' => $bh->timestamp,
            'period' => $bh->period,
        ];
    }

    public function includeBanner(UserBanHistory $bh)
    {
        return $this->item($bh->banner, new UserCompactTransformer);
    }
}

<?php

/**
 *    Copyright 2015-2017 ppy Pty. Ltd.
 *
 *    This file is part of osu!web. osu!web is distributed with the hope of
 *    attracting more community contributions to the core ecosystem of osu!.
 *
 *    osu!web is free software: you can redistribute it and/or modify
 *    it under the terms of the Affero GNU General Public License version 3
 *    as published by the Free Software Foundation.
 *
 *    osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
 *    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *    See the GNU Affero General Public License for more details.
 *
 *    You should have received a copy of the GNU Affero General Public License
 *    along with osu!web.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace App\Transformers;

use App\Models\UserBanHistory;
use League\Fractal;

class UserBanHistoryTransformer extends Fractal\TransformerAbstract
{
    protected $availableIncludes = [
        'banner',
    ];

    public function transform(UserBanHistory $bh)
    {
        return [
            'reason' => $bh->reason,
            'type' => $bh->ban_status,
            'timestamp' => $bh->timestamp,
            'period' => $bh->period,
        ];
    }

    public function includeBanner(UserBanHistory $bh)
    {
        if ($bh->banner !== null) {
            return $this->item($bh->banner, new UserCompactTransformer);
        }
    }
}

Fix fail if no banner id set

Fix fail if no banner id set


<?php
    require_once 'migrate.php';

    migrate(
        [
            'ALTER TABLE
                roundcreatures
            CHANGE
                `action` `action` ENUM("NONE","MOVE","ATTACK") COLLATE utf8_unicode_ci NOT NULL'
        ]
    );
?>

<?php
    require_once 'migrate.php';

    Migration::alterField( 'roundcreatures', 'action', 'action', 'ENUM("NONE","MOVE","ATTACK") COLLATE utf8_unicode_ci NOT NULL' );
?>

Change last migration to new mig format

Change last migration to new mig format


<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Validator;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Validator::extend('same_password', 'App\Validations\UserValidator@validate');
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Validator;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
        Validator::extend('same_password', 'App\Validations\UserValidator@validate');
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

Fix error when run the migrations

Fix error when run the migrations


<?php
namespace Modules\Api\Controllers;

use \PVL\Debug;
use \PVL\Utilities;

class IndexController extends BaseController
{
    public function testAction()
    {
        $this->doNotRender();

        set_time_limit(0);
        ini_set('memory_limit', '-1');

        Debug::setEchoMode();

        $all_keys = \DF\Cache::getKeys();
        Debug::print_r($all_keys);

        Debug::log(\DF\Cache::getSitePrefix());

        Debug::log('Donezo!');
    }
}

<?php
namespace Modules\Api\Controllers;

use \PVL\Debug;
use \PVL\Utilities;

class UtilController extends BaseController
{
    public function testAction()
    {
        $this->doNotRender();

        set_time_limit(0);
        ini_set('memory_limit', '-1');

        Debug::setEchoMode();

        $all_keys = \DF\Cache::getKeys();
        Debug::print_r($all_keys);

        Debug::log(\DF\Cache::getSitePrefix());

        Debug::log('Donezo!');
    }
}

Fix typo on API util page.

Fix typo on API util page.


<?php

function pole_display_price($label, $price) {
  $sock= socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  if (@socket_connect($sock, '127.0.0.1', 1888)) {
    socket_write($sock,
                 sprintf("\x0d\x0a%-19.19s\x0a\x0d$%18.2f ",
                         $label, $price));
  }
}

<?php

function pole_display_price($label, $price) {
  $sock= socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  if (@socket_connect($sock, '127.0.0.1', 1888)) {
    socket_write($sock,
                 sprintf("\x1f\x0d\x0a%-19.19s\x0a\x0d$%18.2f ",
                         $label, $price));
  }
}

Reset display before each message

Reset display before each message


  {{ $settings['site_title'] }} is a program of DoSomething.org.

Facebook

Twitter

Update general twitter share copy.

Update general twitter share copy.


<?php

namespace PigeonWebkit;

use Symfony\Component\CssSelector\CssSelector,
  Behat\Mink\Session;

class FunctionalPigeon extends CapybaraWebkitDriver {

  protected $browser;

  public function __construct() {
    $this->browser = new PigeonBrowser();
    parent::__construct($this->browser);
    $this->setSession(new Session($this));
    $this->start();
  }

  public function setXPathMode($bool) {
    $mode = $bool ? "xpath" : "css";
    $this->browser->setMode($mode);
  }

  public function saveScreenShot($path) {
    file_put_contents($path, $this->getScreenShot());
  }

  public function body() {
    return $this->getContent();
  }

  public function ignoreSslErrors() {
    $this->browser->ignoreSslErrors();
  }
}

class PigeonBrowser extends Browser {

  protected $mode = "css";

  public function find($query) {
    $query = $this->mode == "xpath" ? $query : CssSelector::toXPath($query);
    return parent::find($query);
  }

  public function setMode($mode) {
    $this->mode = $mode;
  }
}

<?php

namespace PigeonWebkit;

use Behat\Mink\Session;

class FunctionalPigeon extends CapybaraWebkitDriver {

  protected $browser;

  public function __construct() {
    $this->browser = new PigeonBrowser();
    parent::__construct($this->browser);
    $this->setSession(new Session($this));
    $this->start();
  }

  public function setXPathMode($bool) {
    $mode = $bool ? "xpath" : "css";
    $this->browser->setMode($mode);
  }

  public function saveScreenShot($path) {
    file_put_contents($path, $this->getScreenShot());
  }

  public function body() {
    return $this->getContent();
  }

  public function ignoreSslErrors() {
    $this->browser->ignoreSslErrors();
  }
}

class PigeonBrowser extends Browser {

  protected $mode = "css";

  public function find($query) {
    $css_selector = new \Symfony\Component\CssSelector\CssSelectorConverter();
    $query = $this->mode == "xpath" ? $query : $css_selector->toXPath($query);
    return parent::find($query);
  }

  public function setMode($mode) {
    $this->mode = $mode;
  }
}

Update use of deprecated CssSelector class


<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\TestExcutionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Test Excutions';
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

        <?= Html::a('Create Test Excution', ['create'], ['class' => 'btn btn-success']) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'teid',
            'tename',
            'milestone',
            'CreateDate',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\TestExcutionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Test Excutions';
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

        <?= Html::a('Create Test Excution', ['create'], ['class' => 'btn btn-success']) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'teid',
            'tename',
            'milestone',
            'CreateDate',

            ['class' => 'yii\grid\ActionColumn',
			'template' => '{link}',
			'buttons' => [
                'link' => function ($url,$model,$key) {
                                return Html::a('Insert Test Cases', 'index.php?r=test-excution%2FInsertTestPlan&id='.$key);
                },
				],//buttons
			],//class
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

Add ”Insert Test Cases“ link

Add ”Insert Test Cases“ link

 in views/test-excution/index.php


<?php namespace Pingpong\Menus;

use Illuminate\Support\ServiceProvider;

class MenusServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = false;

	/**
	 * Bootstrap the application events.
	 *
	 * @return void
	 */
	public function boot()
	{
		$this->package('pingpong/menus');
		$this->requireMenusFile();
	}

	/**
	 * Require the menus file if that file is exists.
	 *
	 * @return void
	 */
	public function requireMenusFile()
	{
		if(file_exists($file = app_path('menus.php')))
		{
			require $file;
		}
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
        $this->app['menus'] = $this->app->share(function($app)
        {
        	return new Menu($app['view'], $app['config']);
        });
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return array('menus');
	}

}

<?php namespace Pingpong\Menus;

use Illuminate\Support\ServiceProvider;

class MenusServiceProvider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->requireMenusFile();
    }

    /**
     * Require the menus file if that file is exists.
     *
     * @return void
     */
    public function requireMenusFile()
    {
        if (file_exists($file = app_path('Support/menus.php'))) require $file;
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerComponent();

        $this->registerNamespaces();
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return array('menus');
    }

    /**
     * Register package's namespaces.
     *
     * @return void
     */
    protected function registerNamespaces()
    {
        $this->mergeConfigFrom(__DIR__ . '/src/config/config.php', 'menus');
        $this->loadViewsFrom(__DIR__ . '/src/views', 'menus');

        $this->publishes([
            __DIR__ . '/src/config/config.php' => config_path('menus.php'),
            __DIR__ . '/src/views' => base_path('resources/views/vendor/menus'),
        ]);
    }

    /**
     * Register package's component.
     *
     * @return void
     */
    protected function registerComponent()
    {
        $this->app['menus'] = $this->app->share(function ($app)
        {
            return new Menu($app['view'], $app['config']);
        });
    }

}

Update the way to register package's namespaces using L5's way


<?php

abstract class InterProcessStorage {
    /**
     * Indicates if the inter-process mechanism is active
     *
     * @access public
     * @return boolean
     */
    public function IsActive();

    /**
     * Initializes internal parameters
     *
     * @access public
     * @return boolean
     */
    public function InitializeParams() {
        if (!isset(self::$devid)) {
            self::$devid = Request::GetDeviceID();
            self::$pid = @getmypid();
            self::$user = Request::GetAuthUser();
            self::$start = time();
        }
        return true;
    }

    /**
     * Reinitializes inter-process data storage
     *
     * @access public
     * @return boolean
     */
    public function ReInitSharedMem();
}

<?php

abstract class InterProcessStorage {
    /**
     * Indicates if the inter-process mechanism is active
     *
     * @access public
     * @return boolean
     */
    abstract public function IsActive();

    /**
     * Initializes internal parameters
     *
     * @access public
     * @return boolean
     */
    public function InitializeParams() {
        if (!isset(self::$devid)) {
            self::$devid = Request::GetDeviceID();
            self::$pid = @getmypid();
            self::$user = Request::GetAuthUser();
            self::$start = time();
        }
        return true;
    }

    /**
     * Reinitializes inter-process data storage
     *
     * @access public
     * @return boolean
     */
    abstract public function ReInitSharedMem();
}

Mark method without body as abstract

fix(ipc): Mark method without body as abstract

Signed-off-by: Francisco Miguel Biete <f1d806242fc0bb697f053bcdfc66a36bc885611e@renr.es>


<?php

namespace Heystack\Subsystem\Ecommerce\Traits;

use Heystack\Subsystem\Core\ServiceStore;

trait OutputHandlerControllerTrait
{

    /**
     * Process the request to the controller and direct it to the correct input
     * and output controllers via the input and output processor services.
     *
     * @return mixed
     */
    public function process()
    {

        $inputHandlerService = ServiceStore::getService('input_processor_handler'); //TODO
        $outputHandlerService = ServiceStore::getService('output_processor_handler'); //TODO

        $request = $this->getRequest();
        $identifier = $request->param('Processor');

        return $outputHandlerService->process(
                $identifier,
                $this,
                $inputHandlerService->process($identifier, $request)
        );

    }

}

<?php

namespace Heystack\Subsystem\Ecommerce\Traits;

use Heystack\Subsystem\Core\ServiceStore;
use Heystack\Subsystem\Core\Services;

trait OutputHandlerControllerTrait
{

    /**
     * Process the request to the controller and direct it to the correct input
     * and output controllers via the input and output processor services.
     *
     * @return mixed
     */
    public function process()
    {

        $inputHandlerService = ServiceStore::getService(Services::INPUT_PROCESSOR_HANDLER);
        $outputHandlerService = ServiceStore::getService(Services::OUTPUT_PROCESSOR_HANDLER);

        $request = $this->getRequest();
        $identifier = $request->param('Processor');

        return $outputHandlerService->process(
                $identifier,
                $this,
                $inputHandlerService->process($identifier, $request)
        );

    }

}

Use services by service const's

UPDATE: Use services by service const's


<?php

class LocalizationScriptTest extends TestCase
{
    public function testScriptRetrieval()
    {
        $response = $this->call('GET', '/js-localization/localization.js');

        $this->assertTrue($response->isOk());

        $content = $response->getContent();
        $this->assertRegExp('/^\(function\(.*\);/', $content);
    }
}

<?php

class LocalizationScriptTest extends TestCase
{
    public function testScriptRetrieval()
    {
        $response = $this->call('GET', '/js-localization/localization.js');

        $this->assertTrue($response->isOk());
        $content = $response->getContent();

        // Test for JS content

        $this->assertRegExp('/^\(function\(.*\);/', $content);
    }

    public function testScriptAndTranslationCombinedRetrieval()
    {
        $response = $this->call('GET', '/js-localization/all.js');

        $this->assertTrue($response->isOk());
        $content = $response->getContent();

        // Test for JS content

        $this->assertRegExp('/^\(function\(.*\);/', $content);

        // Test for Lang.setLocale()

        $locale = \Illuminate\Support\Facades\Lang::locale();
        $this->assertRegExp('/Lang\.setLocale\("'.$locale.'"\);/', $content);

        // Test for Land.addMessages()

        $addMessagesRegex = '/Lang\.addMessages\( (\{.*?\}) \);/x';
        $this->assertRegExp($addMessagesRegex, $content);
    }
}

Add test for all.js request

Add test for all.js request


<?php

namespace VladimirYuldashev\LaravelQueueRabbitMQ;

use Illuminate\Queue\QueueManager;
use Illuminate\Support\ServiceProvider;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnector;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnectorSSL;

class LaravelQueueRabbitMQServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__ . '/../config/rabbitmq.php', 'queue.connections.rabbitmq'
        );
    }

    /**
     * Register the application's event listeners.
     *
     * @return void
     */
    public function boot()
    {
        /** @var QueueManager $queue */
        $queue = $this->app['queue'];

        if ($this->app['config']['rabbitmq']['ssl_params']['ssl_on'] === true) {
            $connector = new RabbitMQConnectorSSL();
        } else {
            $connector = new RabbitMQConnector();
        }

        $queue->stopping(function () use ($connector) {
            $connector->connection()->close();
        });

        $queue->addConnector('rabbitmq', function () use ($connector) {
            return $connector;
        });
    }
}

<?php

namespace VladimirYuldashev\LaravelQueueRabbitMQ;

use Illuminate\Queue\QueueManager;
use Illuminate\Support\ServiceProvider;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnector;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnectorSSL;

class LaravelQueueRabbitMQServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__ . '/../config/rabbitmq.php', 'queue.connections.rabbitmq'
        );
    }

    /**
     * Register the application's event listeners.
     *
     * @return void
     */
    public function boot()
    {
        /** @var QueueManager $queue */
        $queue = $this->app['queue'];

        if ($this->app['config']['rabbitmq']['ssl_params']['ssl_on'] === true) {
            $connector = new RabbitMQConnectorSSL();
        } else {
            $connector = new RabbitMQConnector();
        }

        $queue->stopping(function () use ($connector) {
            if ($connector->connection() instanceof AMQPStreamConnection) {
                $connector->connection()->close();
            }
        });

        $queue->addConnector('rabbitmq', function () use ($connector) {
            return $connector;
        });
    }
}

Fix "Call to a member function close() on null" exception


<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\TextUI\Output\TestDox;

use PHPUnit\TestRunner\TestResult\TestResult;
use PHPUnit\TextUI\Output\ResultPrinter as AbstractResultPrinter;
use PHPUnit\Util\Printer;

/**
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
 */
final class ResultPrinter extends AbstractResultPrinter
{
    public function __construct(Printer $printer, bool $colors)
    {
        parent::__construct($printer, $colors);
    }

    public function printResult(TestResult $result): void
    {
    }
}

<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\TextUI\Output\TestDox;

use PHPUnit\TestRunner\TestResult\TestResult;
use PHPUnit\TextUI\Output\ResultPrinter as AbstractResultPrinter;
use PHPUnit\Util\Printer;

/**
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
 */
final class ResultPrinter extends AbstractResultPrinter
{
    public function __construct(Printer $printer, bool $colors)
    {
        parent::__construct($printer, $colors);
    }

    public function printResult(TestResult $result): void
    {
        $this->printFooter($result);
    }
}

Print footer with summary information

Print footer with summary information


<?php
namespace wcf\system\cronjob;
use wcf\data\acp\session\ACPSessionEditor;
use wcf\data\cronjob\Cronjob;
use wcf\data\session\virtual\SessionVirtualEditor;
use wcf\data\session\SessionEditor;

/**
 * Deletes expired sesions.
 *
 * @author	Marcel Werk
 * @copyright	2001-2015 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	com.woltlab.wcf
 * @subpackage	system.cronjob
 * @category	Community Framework
 */
class SessionCleanUpCronjob extends AbstractCronjob {
	/**
	 * @see	\wcf\system\cronjob\ICronjob::execute()
	 */
	public function execute(Cronjob $cronjob) {
		parent::execute($cronjob);

		ACPSessionEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
		SessionEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
		SessionVirtualEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
	}
}

<?php
namespace wcf\system\cronjob;
use wcf\data\acp\session\virtual\ACPSessionVirtualEditor;
use wcf\data\acp\session\ACPSessionEditor;
use wcf\data\cronjob\Cronjob;
use wcf\data\session\virtual\SessionVirtualEditor;
use wcf\data\session\SessionEditor;

/**
 * Deletes expired sesions.
 *
 * @author	Marcel Werk
 * @copyright	2001-2015 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	com.woltlab.wcf
 * @subpackage	system.cronjob
 * @category	Community Framework
 */
class SessionCleanUpCronjob extends AbstractCronjob {
	/**
	 * @see	\wcf\system\cronjob\ICronjob::execute()
	 */
	public function execute(Cronjob $cronjob) {
		parent::execute($cronjob);

		ACPSessionEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
		ACPSessionVirtualEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
		SessionEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
		SessionVirtualEditor::deleteExpiredSessions(TIME_NOW - SESSION_TIMEOUT);
	}
}

Add virtual acp sessions to clean up cronjob


<?php

use Illuminate\Http\Request;

/* Note: All Routes in this file are automatically prepended with /api */

Route::get('/hello_world', function () {
    return "hello world";
})->middleware('http.basic.auth');

Include Users / Groups APIs

Include Users / Groups APIs


<?php

    use Illuminate\Http\Request;

    /*
    |--------------------------------------------------------------------------
    | API Routes
    |--------------------------------------------------------------------------
    |
    | Here is where you can register API routes for your application. These
    | routes are loaded by the RouteServiceProvider within a group which
    | is assigned the "api" middleware group. Enjoy building your API!
    |
    */

    Route::group(['prefix' => config('system.API_PATH'), 'namespace' => 'API'], function() {
        Route::get('plans', 'MainController@getPlans');

        Route::get('times', function () {return \App\Time::all();});
        Route::get('majors', function () {return \App\Major::all();});
        Route::get('lessons', function () {return \App\Lesson::all();});
    });

<?php

    Route::group(['prefix' => config('system.API_PATH'), 'namespace' => 'API'], function() {
        Route::get('plans', 'MainController@getPlans');

        Route::get('times', function () {return \App\Time::all();});
        Route::get('majors', function () {return \App\Major::all();});
        Route::get('lessons', function () {return \App\Lesson::all();});
    });

ref: Remove default comments in API routes file


<?php

namespace Yajra\Auditable;

/**
 * Class AuditableObserver
 *
 * @package Yajra\Auditable
 */
class AuditableTraitObserver
{
    /**
     * Model's creating event hook.
     *
     * @param \Yajra\Auditable\AuditableTrait $model
     */
    public function creating($model)
    {
        if (! $model->created_by) {
            $model->created_by = $this->getAuthenticatedUserId();
        }

        if (! $model->updated_by) {
            $model->updated_by = $this->getAuthenticatedUserId();
        }
    }

    /**
     * Get authenticated user id depending on model's auth guard.
     *
     * @return int
     */
    protected function getAuthenticatedUserId()
    {
        return auth()->check() ? auth()->id() : 0;
    }

    /**
     * Model's updating event hook.
     *
     * @param \Yajra\Auditable\AuditableTrait $model
     */
    public function updating($model)
    {
        if (! $model->isDirty('updated_by')) {
            $model->updated_by = $this->getAuthenticatedUserId();
        }
    }
}

<?php

namespace Yajra\Auditable;

use Illuminate\Database\Eloquent\Model;

/**
 * Class AuditableObserver
 *
 * @package Yajra\Auditable
 */
class AuditableTraitObserver
{
    /**
     * Model's creating event hook.
     *
     * @param Model $model
     */
    public function creating(Model $model)
    {
        if (! $model->created_by) {
            $model->created_by = $this->getAuthenticatedUserId();
        }

        if (! $model->updated_by) {
            $model->updated_by = $this->getAuthenticatedUserId();
        }
    }

    /**
     * Get authenticated user id depending on model's auth guard.
     *
     * @return int
     */
    protected function getAuthenticatedUserId()
    {
        return auth()->check() ? auth()->id() : 0;
    }

    /**
     * Model's updating event hook.
     *
     * @param Model $model
     */
    public function updating(Model $model)
    {
        if (! $model->isDirty('updated_by')) {
            $model->updated_by = $this->getAuthenticatedUserId();
        }
    }
}

Fix model events param type hint and doc.


<?php

namespace Unicodeveloper\Codepen;

use Illuminate\Support\ServiceProvider;

class CodepenServiceProvider extends ServiceProvider
{

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Publishes all the config file this package needs to function
     * @return void
     */
    public function boot()
    {
        $config = realpath(__DIR__.'/../resources/config/codepen.php');

        $this->publishes([
            $config => config_path('codepen.php')
        ]);
    }

    /**
     * Register the application services
     * @return void
     */
    public function register()
    {
        $this->app->bind('laravel-codepen', function(){

            return new CodepenManager;

        });
    }

    /**
     * Get the services provided by the provider
     * @return array
     */
    public function provides()
    {
        return ['laravel-codepen'];
    }
}

<?php

namespace Unicodeveloper\Codepen;

use Illuminate\Support\ServiceProvider;

class CodepenServiceProvider extends ServiceProvider
{

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Register the application services
     * @return void
     */
    public function register()
    {
        $this->app->bind('laravel-codepen', function(){

            return new CodepenManager;

        });
    }

    /**
     * Get the services provided by the provider
     * @return array
     */
    public function provides()
    {
        return ['laravel-codepen'];
    }
}

[laravel-codepen] Remove boot method from service provider


<?php

namespace FFMPEGWrapper\Common;

use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
use Symfony\Component\PropertyAccess\PropertyAccess;

function getProperty($object, $property, $defaultValue = null)
{
    static $accessor = null;

    if ($accessor === null) {
        $accessor = PropertyAccess::createPropertyAccessor();
    }

    if ($object !== null) {
        try {
            return $accessor->getValue($object, $property);
        } catch (NoSuchPropertyException $e) {
            // noop
        }
    }

    return $defaultValue;
}

function FFMPEGEnvVarArrayToEnvVarObject(array $envVars)
{
    $object = [];

    foreach ($envVars as $envVar) {
        if (! empty($envVar)) {
            $key   = key($envVar);
            $value = $envVar[$key];

            $object[] = (object)[
                "key"   => $key,
                "value" => $value
            ];
        }
    }

    return $object;
}

Add FFMPEGEnvVarArrayToEnvVarObject(...) function to commons


<?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\PropertyInfo\Tests\Extractor;

use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Type;

/**
 * @author Dmitrii Poddubnyi <dpoddubny@gmail.com>
 */
class ConstructorExtractorTest extends TestCase
{
    /**
     * @var ConstructorExtractor
     */
    private $extractor;

    protected function setUp(): void
    {
        $this->extractor = new ConstructorExtractor([new DummyExtractor()]);
    }

    public function testInstanceOf()
    {
        $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface', $this->extractor);
    }

    public function testGetTypes()
    {
        $this->assertEquals([new Type(Type::BUILTIN_TYPE_STRING)], $this->extractor->getTypes('Foo', 'bar', []));
    }

    public function testGetTypesIfNoExtractors()
    {
        $extractor = new ConstructorExtractor([]);
        $this->assertNull($extractor->getTypes('Foo', 'bar', []));
    }
}

<?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\PropertyInfo\Tests\Extractor;

use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Type;

/**
 * @author Dmitrii Poddubnyi <dpoddubny@gmail.com>
 */
class ConstructorExtractorTest extends TestCase
{
    /**
     * @var ConstructorExtractor
     */
    private $extractor;

    protected function setUp(): void
    {
        $this->extractor = new ConstructorExtractor([new DummyExtractor()]);
    }

    public function testInstanceOf()
    {
        $this->assertInstanceOf(\Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface::class, $this->extractor);
    }

    public function testGetTypes()
    {
        $this->assertEquals([new Type(Type::BUILTIN_TYPE_STRING)], $this->extractor->getTypes('Foo', 'bar', []));
    }

    public function testGetTypesIfNoExtractors()
    {
        $extractor = new ConstructorExtractor([]);
        $this->assertNull($extractor->getTypes('Foo', 'bar', []));
    }
}

Use ::class keyword when possible

Use ::class keyword when possible


<?php

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

class AddWeeklyReportColumnToUsersTable extends Migration {
    public function up() {
        Schema::table('users', function (Blueprint $table) {
            $table->boolean('weekly_report')->default(false)->after('theme');
        });
    }

    public function down() {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('weekly_report');
        });
    }
}

<?php

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

class AddWeeklyReportColumnToUsersTable extends Migration {
    public function up() {
        Schema::table('users', function (Blueprint $table) {
            $table->boolean('weekly_report')->default(true)->after('theme');
        });
    }

    public function down() {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('weekly_report');
        });
    }
}

Set weekly_report column in users table to true by default


<?php
/**
 * @version     $Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Contacts
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Category Controller Class
 *
 * @author      Johan Janssens <http://nooku.assembla.com/profile/johanjanssens>
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Contacts
 */
class ComContactsControllerCategory extends ComDefaultControllerDefault
{
    protected function _actionGet(KCommandContext $context)
    {
        $view = $this->getView();

	    //Set the layout
        if($view instanceof KViewTemplate)
	    {
	        $layout = clone $view->getIdentifier();
	        $layout->package  = 'categories';
	        $layout->name     = $view->getLayout();

	        //Force re-creation of the filepath to load the category templates
	        $layout->filepath = '';

	        $view->setLayout($layout);
	    }

	    //Set the toolbar
	    if($this->isCommandable()) {
	        $this->setToolbar('admin::com.categories.controller.toolbar.'.$view->getName());
	    }

        return parent::_actionGet($context);
    }

    public function setModel($model)
    {
        $model = parent::setModel($model);
        $model->package = 'categories';

        return $model;
    }

	public function getRequest()
	{
		$this->_request['section'] = 'com_contact_details';
	    return $this->_request;
	}
}

<?php
/**
 * @version     $Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Contacts
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Category Controller Class
 *
 * @author      Johan Janssens <http://nooku.assembla.com/profile/johanjanssens>
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Contacts
 */
class ComContactsControllerCategory extends ComCategoriesControllerCategory
{
	public function getRequest()
	{
		$this->_request['section'] = 'com_contact_details';
	    return $this->_request;
	}
}

Extend from new ComCategoriesControllerCategory controller.


<?php
/**
 * Error handler
 */
set_error_handler(
    function ($severity, $message, $file, $line) {
        throw new ErrorException($message, 0, $severity, $file, $line);
    }
);
set_exception_handler(
    function ($e) {
        echo '
' . (string) $e . '
';
    }
);
register_shutdown_function(
    function () {
        $error = error_get_last();
        $errors = [E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING];

        if ($error && in_array($error['type'], $errors)) {
            echo '
' . print_r($error, 1) . '
';
        }
    }
);

/**
 * Init and run application
 */
foreach (glob(__DIR__ . '/../src/*.php') as $file) {
    include_once $file;
}

app\run();

<?php
/**
 * Initialize application
 */
foreach (glob(__DIR__ . '/../src/*.php') as $file) {
    include_once $file;
}

/**
 * Error handler
 */
set_error_handler(
    function ($severity, $message, $file, $line) {
        throw new ErrorException($message, 0, $severity, $file, $line);
    }
);
set_exception_handler(
    function ($e) {
        echo '
' . (string) $e . '
';
    }
);
register_shutdown_function(
    function () {
        $error = error_get_last();
        $errors = [E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING];

        if ($error && in_array($error['type'], $errors)) {
            echo '
' . print_r($error, 1) . '
';
        }
    }
);

/**
 * Run application
 */
app\run();

Initialize application before error handler registration


<?php
namespace AuthorBooks\Model;

use Maghead\Schema\DeclareSchema;

class AuthorSchema extends DeclareSchema
{
    public function schema()
    {
        $this->column('name')
            ->varchar(128)
            ->findable()
            ;

        $this->column('email')
            ->required()
            ->findable()
            ->varchar(128);

        $this->column('account_brief')
            ->label('Account Brief')
            ->virtual()
            ->inflator(function ($value, $record) {
                return $record->name . '(' . $record->email . ')';
            });

        $this->column('identity')
            ->unique()
            ->required()
            ->varchar(128)
            ->validator('StringLength', ['min' => 3, 'max' => 64])
            ->findable()
            ;

        $this->column('confirmed')
            ->boolean()
            ->default(false);

        $this->mixin('Maghead\\Schema\\Mixin\\MetadataMixinSchema');

        $this->many('addresses', 'AuthorBooks\Model\AddressSchema', 'author_id', 'id');

        $this->many('unused_addresses', 'AuthorBooks\Model\AddressSchema', 'author_id', 'id')
            ->where()
                ->equal('unused', true);

        $this->many('author_books', 'AuthorBooks\Model\AuthorBookSchema', 'author_id', 'id');

        $this->manyToMany('books', 'author_books', 'book');
    }
}

<?php
namespace AuthorBooks\Model;

use Maghead\Schema\DeclareSchema;

class AuthorSchema extends DeclareSchema
{
    public function schema()
    {
        $this->column('name')
            ->varchar(128)
            ->findable()
            ;

        $this->column('email')
            ->required()
            ->findable()
            ->varchar(128);

        $this->column('account_brief')
            ->label('Account Brief')
            ->virtual()
            ->inflator(function ($value, $record) {
                return $record->name . '(' . $record->email . ')';
            });

        $this->column('identity')
            ->unique()
            ->required()
            ->varchar(128)
            ->validator('StringLength', ['min' => 3, 'max' => 64])
            ->findable()
            ;

        $this->column('confirmed')
            ->boolean()
            ->default(false);

        $this->mixin('Maghead\\Schema\\Mixin\\MetadataMixinSchema');

        $this->many('addresses', AddressSchema::class, 'author_id', 'id');

        $this->many('unused_addresses', AddressSchema::class, 'author_id', 'id')
            ->where()->equal('unused', true);

        $this->many('author_books', AuthorBookSchema::class, 'author_id', 'id');

        $this->manyToMany('books', 'author_books', 'book');
    }
}

Use ::class keyword to get class names

Use ::class keyword to get class names


<?php

use Illuminate\Database\Seeder;
use Northstar\Models\Client;
use Northstar\Auth\Scope;

class ClientTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('clients')->delete();

        // For easy testing, we'll seed one client for web authentication:
        factory(Client::class, 'authorization_code')->create([
            'title' => 'Local Development',
            'description' => 'This is an example web OAuth client seeded with your local Northstar installation.',
            'allowed_grant' => 'authorization_code',
            'client_id' => 'oauth-test-client',
            'client_secret' => 'secret1',
            'scope' => collect(Scope::all())->except('admin')->keys()->toArray(),
            // @NOTE: We're omitting 'redirect_uri' here for easy local dev.
            'redirect_uri' => null,
        ]);

        // ..and one for machine authentication:
        factory(Client::class, 'client_credentials')->create([
            'title' => 'Local Development (Machine)',
            'description' => 'This is an example machine OAuth client seeded with your local Northstar installation.',
            'allowed_grant' => 'client_credentials',
            'client_id' => 'machine-test-client',
            'client_secret' => 'secret2',
            'scope' => collect(Scope::all())->keys()->toArray(),
        ]);
    }
}

<?php

use Illuminate\Database\Seeder;
use Northstar\Models\Client;
use Northstar\Auth\Scope;

class ClientTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('clients')->delete();

        // For easy testing, we'll seed one client for web authentication:
        factory(Client::class, 'authorization_code')->create([
            'title' => 'Local Development',
            'description' => 'This is an example web OAuth client seeded with your local Northstar installation.',
            'allowed_grant' => 'authorization_code',
            'client_id' => 'dev-oauth',
            'client_secret' => 'secret1',
            'scope' => collect(Scope::all())->except('admin')->keys()->toArray(),
            // @NOTE: We're omitting 'redirect_uri' here for easy local dev.
            'redirect_uri' => null,
        ]);

        // ..and one for machine authentication:
        factory(Client::class, 'client_credentials')->create([
            'title' => 'Local Development (Machine)',
            'description' => 'This is an example machine OAuth client seeded with your local Northstar installation.',
            'allowed_grant' => 'client_credentials',
            'client_id' => 'dev-machine',
            'client_secret' => 'secret2',
            'scope' => collect(Scope::all())->keys()->toArray(),
        ]);
    }
}

Rename seed clients for consistency.

Rename seed clients for consistency.


<?php
/*
 * Copyright (c) 2014 Chris Wells (https://chriswells.io)
 *
 * 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 CWA\MVC\Views;

require_once \CWA\LIB_PATH . 'cwa/mvc/views/View.php';

class ErrorView extends View
{
	/* Protected methods: */

	protected function detectFormat() {
		parent::detectFormat();
		// Prevent recursive "partial not found" errors. -- cwells
		if (!file_exists("views/Error/default.$this->format.php")) {
			$this->format = 'html';
		}
	}
}

?>

<?php
/*
 * Copyright (c) 2014 Chris Wells (https://chriswells.io)
 *
 * 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 CWA\MVC\Views;

require_once \CWA\LIB_PATH . 'cwa/mvc/views/View.php';

class ErrorView extends View
{
	/* Protected methods: */

	protected function detectFormat() {
		parent::detectFormat();
		// Prevent recursive "partial not found" errors. -- cwells
		if ($this->format !== 'json' && !file_exists("views/Error/view.$this->format.php")) {
			$this->format = 'html';
		}
	}
}

?>

Allow errors/exceptions to be returned in JSON format.


<?php
namespace Phakebuilder;
/**
 * Composer class
 *
 * @author Leonid Mamchenkov <l.mamchenkov@qobo.biz>
 */
class Composer {

	// Shorter form of --no-interaction
	const DEFAULT_COMMAND = 'composer -n';

	protected $command;

	/**
	 * Constructor
	 *
	 * @param string $command Path to executable
	 * @return object
	 */
	public function __construct($command = self::DEFAULT_COMMAND) {
		$this->command = $command ?: self::DEFAULT_COMMAND;
	}

	/**
	 * Install composer dependecies
	 *
	 * @return string
	 */
	public function install() {
		$result = $this->command . ' install --no-dev';
		return $result;
	}

	/**
	 * Update composer dependecies
	 *
	 * @return string
	 */
	public function update() {
		$result = $this->command . ' update --no-dev';
		return $result;
	}

}

<?php
namespace Phakebuilder;
/**
 * Composer class
 *
 * @author Leonid Mamchenkov <l.mamchenkov@qobo.biz>
 */
class Composer {

	// Shorter form of --no-interaction
	const DEFAULT_COMMAND = 'composer -n --no-dev';

	protected $command;

	/**
	 * Constructor
	 *
	 * @param string $command Path to executable
	 * @return object
	 */
	public function __construct($command = self::DEFAULT_COMMAND) {
		$this->command = $command ?: self::DEFAULT_COMMAND;
	}

	/**
	 * Install composer dependecies
	 *
	 * @return string
	 */
	public function install() {
		$result = $this->command . ' install';
		return $result;
	}

	/**
	 * Update composer dependecies
	 *
	 * @return string
	 */
	public function update() {
		$result = $this->command . ' update';
		return $result;
	}

}

Allow composer command to overwrite --no-dev


<?php

namespace Athens\Core\Page;

use Athens\Core\Writable\WritableInterface;
use Athens\Core\Initializer\InitializableInterface;
use Athens\Core\WritableBearer\WritableBearerBearerInterface;
use Athens\Core\Writer\HTMLWriter;
use Athens\Core\Initializer\Initializer;

interface PageInterface extends
    WritableInterface,
    WritableBearerBearerInterface,
    InitializableInterface,
    PageConstantsInterface
{

    /**
     * @return string
     */
    public function getTitle();

    /**
     * @return string
     */
    public function getBaseHref();

    /**
     * @return string
     */
    public function getType();

    /**
     * @return mixed
     */
    public function render();
}

<?php

namespace Athens\Core\Page;

use Athens\Core\Writable\WritableInterface;
use Athens\Core\Initializer\InitializableInterface;
use Athens\Core\WritableBearer\WritableBearerBearerInterface;
use Athens\Core\Writer\HTMLWriter;
use Athens\Core\Initializer\Initializer;

interface PageInterface extends
    WritableInterface,
    WritableBearerBearerInterface,
    InitializableInterface,
    PageConstantsInterface
{

    /**
     * @return string
     */
    public function getTitle();

    /**
     * @return string
     */
    public function getBaseHref();

    /**
     * @return string
     */
    public function getType();

    /**
     * @return PageInterface
     */
    public function initialize();

    /**
     * @return PageInterface
     */
    public function render();
}

Add initialize to page interface.

Add initialize to page interface.


<?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 controller to call when that URI is requested.
|
*/

Route::resource('/admin/navigation', 'ZaLaravel\LaravelNavigation\Controllers\AdminNavigationController');

<?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 controller to call when that URI is requested.
|
*/

Route::model('user', 'ZaLaravel\LaravelNavigation\Models\Navigation');
Route::resource('/admin/navigation', 'ZaLaravel\LaravelNavigation\Controllers\AdminNavigationController');

Add navigation route model binding

Add navigation route model binding


<?php

namespace Rogue\Http\Controllers\Api;

use Rogue\Models\Post;
use Rogue\Models\Signup;
use Rogue\Services\PostService;
use Rogue\Repositories\SignupRepository;
use Rogue\Http\Transformers\PostTransformer;
use Rogue\Http\Controllers\Traits\PostRequests;

class PostsController extends ApiController
{
    use PostRequests;

    /**
     * The post service instance.
     *
     * @var Rogue\Services\PostService
     */
    protected $posts;

    /**
     * The signup repository instance.
     *
     * @var Rogue\Repositories\SignupRepository
     */
    protected $signups;

    /**
     * @var \League\Fractal\TransformerAbstract;
     */
    protected $transformer;

    /**
     * Create a controller instance.
     *
     * @param  PostContract  $posts
     * @return void
     */
    public function __construct(PostService $posts, SignupRepository $signups)
    {
        $this->posts = $posts;
        $this->signups = $signups;

        $this->transformer = new PostTransformer;
    }
}

<?php

namespace Rogue\Http\Controllers\Api;

use Rogue\Services\PostService;
use Rogue\Repositories\SignupRepository;
use Rogue\Http\Transformers\PostTransformer;
use Rogue\Http\Controllers\Traits\PostRequests;

class PostsController extends ApiController
{
    use PostRequests;

    /**
     * The post service instance.
     *
     * @var \Rogue\Services\PostService
     */
    protected $posts;

    /**
     * The signup repository instance.
     *
     * @var \Rogue\Repositories\SignupRepository
     */
    protected $signups;

    /**
     * @var \League\Fractal\TransformerAbstract;
     */
    protected $transformer;

    /**
     * Create a controller instance.
     *
     * @param  PostContract  $posts
     * @return void
     */
    public function __construct(PostService $posts, SignupRepository $signups)
    {
        $this->posts = $posts;
        $this->signups = $signups;

        $this->transformer = new PostTransformer;
    }
}

Remove unused imports & fix docblocks.

Remove unused imports & fix docblocks.


<?php

namespace Igniter\Flame\Exception;

use October\Rain\Exception\ErrorHandler as OctoberErrorHandler;

/**
 * System Error Handler, this class handles application exception events.
 */
class ErrorHandler extends OctoberErrorHandler
{
}

<?php

namespace Igniter\Flame\Exception;

use Config;
use Exception;
use October\Rain\Exception\ErrorHandler as OctoberErrorHandler;

/**
 * System Error Handler, this class handles application exception events.
 */
class ErrorHandler extends OctoberErrorHandler
{
    /**
     * Returns a more descriptive error message if application
     * debug mode is turned on.
     * @param Exception $exception
     * @return string
     */
    public static function getDetailedMessage($exception)
    {
        $message = $exception->getMessage();

        if (!($exception instanceof ApplicationException) && Config::get('app.debug', FALSE)) {
            $message = sprintf('"%s" on line %s of %s',
                $exception->getMessage(),
                $exception->getLine(),
                $exception->getFile()
            );

            $message .= $exception->getTraceAsString();
        }

        return $message;
    }
}

Include exception trace string in detailed debug message


<?php $view->extend('DoctrineUserBundle::layout') ?>

<?php if ($view->session->hasFlash('doctrine_user_session_new/error')): ?>

Bad username or password, please try again.

<?php endif; ?>

<?php echo $form->renderFormTag($view->router->generate('doctrine_user_session_create'), array('class' => 'doctrine_user_session_new')) ?>

        Username or email:
        <?php echo $form['usernameOrEmail']->render(); ?>

        Password:
        <?php echo $form['password']->render(); ?>

        <input type="submit" value="Log in" />

</form>

<?php $view->extend('DoctrineUserBundle::layout') ?>

<?php if ($view->session->hasFlash('doctrine_user_session_new/error')): ?>

Bad username or password, please try again.

<?php endif; ?>

<?php echo $form->getRawValue()->renderFormTag($view->router->generate('doctrine_user_session_create'), array('class' => 'doctrine_user_session_new')) ?>

        Username or email:
        <?php echo $form['usernameOrEmail']->getRawValue()->render(); ?>

        Password:
        <?php echo $form['password']->getRawValue()->render(); ?>

        <input type="submit" value="Log in" />

</form>

Make login form template work even if form is escaped


<?php
namespace wcf\system\importer;
use wcf\data\article\Article;
use wcf\data\object\type\ObjectTypeCache;

/**
 * Imports article comments.
 *
 * @author	Marcel Werk
 * @copyright	2001-2019 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Importer
 */
class ArticleCommentImporter extends AbstractCommentImporter {
	/**
	 * @inheritDoc
	 */
	protected $objectTypeName = 'com.woltlab.wcf.article.comment';

	/**
	 * Creates a new ArticleCommentImporter object.
	 */
	public function __construct() {
		$objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.articleComment');
		$this->objectTypeID = $objectType->objectTypeID;
	}

	/**
	 * @inheritDoc
	 */
	public function import($oldID, array $data, array $additionalData = []) {
		$articleID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.article', $additionalData['articleID']);
		if (!$articleID) return 0;
		$article = new Article($articleID);
		$contents = $article->getArticleContents();
		$data['objectID'] = reset($contents)->articleContentID;

		return parent::import($oldID, $data);
	}
}

<?php
namespace wcf\system\importer;
use wcf\data\article\Article;
use wcf\data\object\type\ObjectTypeCache;

/**
 * Imports article comments.
 *
 * @author	Marcel Werk
 * @copyright	2001-2019 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Importer
 */
class ArticleCommentImporter extends AbstractCommentImporter {
	/**
	 * @inheritDoc
	 */
	protected $objectTypeName = 'com.woltlab.wcf.article.comment';

	/**
	 * Creates a new ArticleCommentImporter object.
	 */
	public function __construct() {
		$objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.articleComment');
		$this->objectTypeID = $objectType->objectTypeID;
	}

	/**
	 * @inheritDoc
	 */
	public function import($oldID, array $data, array $additionalData = []) {
		$articleID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.article', $data['objectID'] ?? $additionalData['articleID']);
		if (!$articleID) return 0;
		$article = new Article($articleID);
		$contents = $article->getArticleContents();
		$data['objectID'] = reset($contents)->articleContentID;

		return parent::import($oldID, $data);
	}
}

Support standard `objectID` for article importer

`$additionalData['articleID']` is used by the wordpress importer and kept as a fallback.


<?php
/**
 * This class is for the frontend view for an entire year.
 *
 * It contains basically 4 rows of 3 months, for a total of 12
 * monthwidgets.
 *
 * @package UNL_UCBCN_Frontend
 * @author Brett Bieber
 */
class UNL_UCBCN_Frontend_Year extends UNL_UCBCN
{
	public $year;
	public $monthwidgets = array();
	public $calendar;
	function __construct($y,$calendar)
	{
		$this->year = $y;
		$this->calendar = $calendar;
		$m = 1;
		for ($m=1;$m<=12;$m++) {
			$this->monthwidgets[] = new UNL_UCBCN_Frontend_MonthWidget($this->year,$m,$this->calendar);
		}
	}
}
?>

<?php
/**
 * This class is for the frontend view for an entire year.
 *
 * It contains basically 4 rows of 3 months, for a total of 12
 * monthwidgets.
 *
 * @package UNL_UCBCN_Frontend
 * @author Brett Bieber
 */

require_once 'UNL/UCBCN.php';
require_once 'UNL/UCBCN/Frontend/MonthWidget.php';

class UNL_UCBCN_Frontend_Year extends UNL_UCBCN
{
	public $year;
	public $monthwidgets = array();
	public $calendar;
	function __construct($y,$calendar)
	{
		$this->year = $y;
		$this->calendar = $calendar;
		$m = 1;
		for ($m=1;$m<=12;$m++) {
			$this->monthwidgets[] = new UNL_UCBCN_Frontend_MonthWidget($this->year,$m,$this->calendar);
		}
	}
}
?>

Add require statements to the year view... this fixes error with class monthwidget not found.


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

namespace ZendTest\Code\Generator;

use Zend\Code\Generator\AbstractMemberGenerator;
use Zend\Code\Generator\Exception\InvalidArgumentException;

class AbstractMemberGeneratorTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var AbstractMemberGenerator
     */
    private $fixture;

    protected function setUp()
    {
        $this->fixture = $this->getMockForAbstractClass('Zend\Code\Generator\AbstractMemberGenerator');
    }

    public function testSetFlagsWithArray()
    {
        $this->fixture->setFlags(
            array(
                AbstractMemberGenerator::FLAG_FINAL,
                AbstractMemberGenerator::FLAG_PUBLIC,
            )
        );

        $this->assertEquals(AbstractMemberGenerator::VISIBILITY_PUBLIC, $this->fixture->getVisibility());
        $this->assertEquals(true, $this->fixture->isFinal());
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testSetDocBlockThrowsExceptionWithInvalidType()
    {
        $this->fixture->setDocBlock(new \stdClass());
    }
}

Fix errors reported by php-cs-fixer

Fix errors reported by php-cs-fixer


<?php

namespace Orphans\GitDeploy\Events;

use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class GitDeployed
{
    use SerializesModels;

    public $commits;

    /**
     * Create a new event instance.
     *
     * @param  Order  $order
     * @return void
     */
    public function __construct($commits)
    {
        $this->commits = $commits;
    }

    /**
     * Get the channels the event should be broadcast on.
     *
     * @return array
     */
    public function broadcastOn()
    {
        return [];
    }
}

<?php

namespace Orphans\GitDeploy\Events;

use Illuminate\Queue\SerializesModels;

class GitDeployed
{
    use SerializesModels;

    public $commits;

    /**
     * Create a new event instance.
     *
     * @param  Order  $order
     * @return void
     */
    public function __construct($commits)
    {
        $this->commits = $commits;
    }

}

Remove boardcast again, not needed.

Remove boardcast again, not needed.


<?php

/*
 * (c) Jérémy Marodon <marodon.jeremy@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Th3Mouk\RxTraining\Commands;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Th3Mouk\RxTraining\Commands\Styles\SuccessTrait;
use Th3Mouk\RxTraining\Producers\PizzaOrderingProducer;

class ProduceCommand extends Command
{
    use SuccessTrait;

    protected function configure()
    {
        $this
            // the name of the command (the part after "bin/console")
            ->setName('produce')

            // the short description shown while running "php bin/console list"
            ->setDescription('Generate some dumb pizza ordering.')

            // number of pizza ordering
            ->addOption(
                'orders',
                null,
                InputOption::VALUE_REQUIRED,
                'How many pizza orders do you want?',
                20
            );
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->getFormatter()->setStyle('leaf', $this->getSuccessStyle());
        $orders = $input->getOption('orders');

        $pizza_producer = new PizzaOrderingProducer($output, $orders);
        $pizza_producer->produce();
    }
}

<?php

/*
 * (c) Jérémy Marodon <marodon.jeremy@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Th3Mouk\RxTraining\Commands;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Th3Mouk\RxTraining\Commands\Styles\SuccessTrait;
use Th3Mouk\RxTraining\Producers\PizzaOrderingProducer;

class ProduceCommand extends Command
{
    use SuccessTrait;

    protected function configure()
    {
        $this
            // the name of the command
            ->setName('produce')

            // the short description of the command
            ->setDescription('Generate some dumb pizza ordering.')

            // number of pizza ordering
            ->addOption(
                'orders',
                null,
                InputOption::VALUE_REQUIRED,
                'How many pizza orders do you want?',
                20
            );
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->getFormatter()->setStyle('leaf', $this->getSuccessStyle());
        $orders = $input->getOption('orders');

        $pizza_producer = new PizzaOrderingProducer($output, $orders);
        $pizza_producer->produce();
    }
}

Correct some comments in command producer


<?php
include_once 'db_queries.php';
$data = calculateUserRanking().",".calculateRanking().",".getTotalChanges();
echo json_encode($data);
?>

<?php
include_once 'db_queries.php';
$data = calculateUserRanking();
$firstMerge = array_merge(calculateUserRanking(), calculateRanking());
$secondMerge = array_merge($firstMerge, getTotalChanges());
echo json_encode($secondMerge);
?>

Test file for unufying the requests

Test file for unufying the requests


Copyright © Purdue IEEE <?php echo date("Y") ?>

    <?php if ($carousel) {
    //Activate the carousel on the main page only ?>

    <?php } ?>

Copyright © Purdue IEEE
                    <?php
                        date_default_timezone_set("UTC");
                        echo date("Y");
                    ?>

    <?php if ($carousel) {
    //Activate the carousel on the main page only ?>

    <?php } ?>

Set timezone because it complains

Set timezone because it complains


<?php
declare(strict_types=1);

namespace Neos\Flow\Persistence;

/*
 * 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;

/**
 * A container for the list of allowed objects to be persisted during this request.
 *
 * @Flow\Scope("singleton")
 */
final class AllowedObjectsContainer extends \SplObjectStorage
{
    /**
     * @var bool
     */
    protected $checkNext = false;

    /**
     * Set the internal flag to return true for `shouldCheck()` on the next invocation.
     *
     * @param bool $checkNext
     */
    public function checkNext($checkNext = true)
    {
        $this->checkNext = $checkNext;
    }

    /**
     * Returns true if allowed objects should be checked this time and resets the internal flag to false,
     * so the next call will return false unless `checkNext(true)` is called again.
     *
     * @return bool
     */
    public function shouldCheck(): bool
    {
        $shouldCheck = $this->checkNext;
        $this->checkNext = false;
        return $shouldCheck;
    }
}

<?php
declare(strict_types=1);

namespace Neos\Flow\Persistence;

/*
 * 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;

/**
 * A container for the list of allowed objects to be persisted during this request.
 *
 * @Flow\Scope("singleton")
 */
final class AllowedObjectsContainer extends \SplObjectStorage
{
    /**
     * @var bool
     */
    protected $checkNext = false;

    /**
     * Set the internal flag to return true for `shouldCheck()` on the next invocation.
     *
     * @param bool $checkNext
     */
    public function checkNext(bool $checkNext = true): void
    {
        $this->checkNext = $checkNext;
    }

    /**
     * Returns true if allowed objects should be checked this time and resets the internal flag to false,
     * so the next call will return false unless `checkNext(true)` is called again.
     *
     * @return bool
     */
    public function shouldCheck(): bool
    {
        $shouldCheck = $this->checkNext;
        $this->checkNext = false;
        return $shouldCheck;
    }
}

!!!TASK: Add method argument and return type hints


<?php

require_once 'Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();

$configuration = new \Doctrine\Common\Cli\Configuration();

$cli = new \Doctrine\Common\Cli\CliController($configuration);
$cli->run($_SERVER['argv']);

<?php

require_once 'Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();

$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$configuration = new \Doctrine\Common\Cli\Configuration();

if (file_exists($configFile)) {
    if ( ! is_readable($configFile)) {
        trigger_error(
            'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
        );
    }

    require $configFile;

    foreach ($GLOBALS as $configCandidate) {
        if ($configCandidate instanceof \Doctrine\Common\Cli\Configuration) {
            $configuration = $configCandidate;
            break;
        }
    }
}

$cli = new \Doctrine\Common\Cli\CliController($configuration);
$cli->run($_SERVER['argv']);

[2.0] Fix for CLI Configuration and PEAR installer

git-svn-id: c8c49e1140e1cd2a8fb163f3c2b0f6eec231a71d@7064 625475ce-881a-0410-a577-b389adb331d8


<?php
// Map 'src' and 'lib' folders to the Wsdl2PhpGenerator namespace in your
// favorite PSR-0 compatible classloader or require the files manually.
require __DIR__ . '/../vendor/autoload.php';

use Wsdl2PhpGenerator\Config;

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(new Config(array(
    'inputFile'                      => './YellowCubeService_005/YellowCubeService.wsdl',
    'outputDir'                      => 'gen/YellowCube',
    'verbose'                        => false,
    'namespaceName'                  => 'YellowCube',
    'sharedTypes'                    => true,
    'constructorParamsDefaultToNull' => true,
    'soapClientClass'                => '\\YellowCube\Util\SoapClient'
)));

<?php
// Map 'src' and 'lib' folders to the Wsdl2PhpGenerator namespace in your
// favorite PSR-0 compatible classloader or require the files manually.
require __DIR__ . '/../vendor/autoload.php';

use Wsdl2PhpGenerator\Config;

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(new Config(array(
    'inputFile'                      => __DIR__ . '/../YellowCubeService_009/YellowCubeService_extern.wsdl',
    'outputDir'                      => 'gen/YellowCube',
    'verbose'                        => false,
    'namespaceName'                  => 'YellowCube',
    'sharedTypes'                    => true,
    'constructorParamsDefaultToNull' => true,
    'soapClientClass'                => '\\YellowCube\Util\SoapClient'
)));

Switch to API version 009 for generation.


<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright    Copyright 2014, Block 8 Limited.
* @license      https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link         https://www.phptesting.org/
*/

session_start();

require_once('../bootstrap.php');

$fc = new PHPCI\Application($config, new b8\Http\Request());
print $fc->handleRequest();

<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright    Copyright 2014, Block 8 Limited.
* @license      https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link         https://www.phptesting.org/
*/

session_set_cookie_params(43200); // Set session cookie to last 12 hours.
session_start();

require_once('../bootstrap.php');

$fc = new PHPCI\Application($config, new b8\Http\Request());
print $fc->handleRequest();

Update session cookie to last 12 hours.

Update session cookie to last 12 hours.


#!/usr/bin/env php
<?php
require dirname(__DIR__).'/vendor/autoload.php';

use Icicle\Awaitable;
use Icicle\Concurrent\Worker\DefaultPool;
use Icicle\Coroutine\Coroutine;
use Icicle\Examples\Concurrent\BlockingTask;
use Icicle\Loop;

$generator = function () {
    $pool = new DefaultPool();
    $pool->start();

    $results = (yield Awaitable\all([
        'google.com' => new Coroutine($pool->enqueue(new BlockingTask('file_get_contents', 'https://google.com'))),
        'icicle.io'  => new Coroutine($pool->enqueue(new BlockingTask('file_get_contents', 'https://icicle.io'))),
    ]));

    foreach ($results as $source => $result) {
        printf("Read from %s: %d bytes\n", $source, strlen($result));
    }

    yield $pool->shutdown();
};

$coroutine = new Coroutine($generator());
$coroutine->done();

Loop\periodic(0.1, function () {
    printf(".\n");
})->unreference();

Loop\run();

#!/usr/bin/env php
<?php
require dirname(__DIR__).'/vendor/autoload.php';

use Icicle\Awaitable;
use Icicle\Concurrent\Worker\DefaultPool;
use Icicle\Coroutine;
use Icicle\Examples\Concurrent\BlockingTask;
use Icicle\Loop;

Coroutine\create(function() {
    $pool = new DefaultPool();
    $pool->start();

    Coroutine\create(function () use ($pool) {
        $result = (yield $pool->enqueue(new BlockingTask('file_get_contents', 'https://google.com')));
        printf("Read from google.com: %d bytes\n", strlen($result));
    });

    Coroutine\create(function () use ($pool) {
        $result = (yield $pool->enqueue(new BlockingTask('file_get_contents', 'https://icicle.io')));
        printf("Read from icicle.io: %d bytes\n", strlen($result));
    });

    yield $pool->shutdown();
})->done();

Loop\periodic(0.1, function () {
    printf(".\n");
})->unreference();

Loop\run();

Update example to demonstrate concurrency


<?php
require_once __DIR__.'/src/Boris/Loader/Loader.php';
require_once __DIR__.'/src/Boris/Loader/Provider/ProviderInterface.php';
require_once __DIR__.'/src/Boris/Loader/Provider/AbstractProvider.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Composer.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Drupal.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Drupal7.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Drupal8.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Symfony.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Symfony2.php';
require_once __DIR__.'/src/Boris/Loader/Provider/EzPublish.php';

<?php
require_once __DIR__.'/src/Boris/Loader/Loader.php';
require_once __DIR__.'/src/Boris/Loader/Provider/ProviderInterface.php';
require_once __DIR__.'/src/Boris/Loader/Provider/AbstractProvider.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Composer.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Drupal7.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Drupal8.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Drupal.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Symfony2.php';
require_once __DIR__.'/src/Boris/Loader/Provider/Symfony.php';
require_once __DIR__.'/src/Boris/Loader/Provider/EzPublish.php';

Fix class loading order for deprecated classes

The deprecated classes (Drupal and Symfony) now extend Drupal8 and
Symfony2, so those need to be loaded first.


<?php
$DIR_BASE_CORE = dirname(__DIR__);
define('DIR_BASE', dirname($DIR_BASE_CORE));

require $DIR_BASE_CORE . '/bootstrap/configure.php';
require $DIR_BASE_CORE . '/bootstrap/autoload.php';

if (!\Concrete\Core\Application\Application::isRunThroughCommandLineInterface()) {
    return false;
}

$cms = require $DIR_BASE_CORE . '/bootstrap/start.php';

$app = new \Concrete\Core\Console\Application();
$cms->instance('console', $app);
if ($cms->isInstalled()) {
    $cms->setupPackageAutoloaders();
    $cms->setupPackages();
}
$app->setupDefaultCommands();

\Events::dispatch('on_before_console_run');

$app->run();

\Events::dispatch('on_after_console_run');

<?php
$DIR_BASE_CORE = dirname(__DIR__);

if (stripos(PHP_OS, 'WIN') === 0) {
    foreach (array('PHP_SELF', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PATH_TRANSLATED') as $key) {
        // Check if the key is valid
        if (!isset($_SERVER[$key])) {
            continue;
        }
        $value = $_SERVER[$key];
        if (!is_file($value)) {
            continue;
        }
        // Just to simplify the regular expressions
        $value = str_replace('\\', '/', $value);
        // Check if the key is an absolute path
        if (preg_match('%^([A-Z]:/|//\w)%i', $value) !== 1) {
            continue;
        }
        if (preg_match('%/\.{1,2}/%', $value) !== 0) {
            continue;
        }
        // Ok!
        $DIR_BASE_CORE = dirname(dirname($value));
        break;
    }
    unset($key);
    unset($value);
}

define('DIR_BASE', dirname($DIR_BASE_CORE));

require $DIR_BASE_CORE . '/bootstrap/configure.php';
require $DIR_BASE_CORE . '/bootstrap/autoload.php';

if (!\Concrete\Core\Application\Application::isRunThroughCommandLineInterface()) {
    return false;
}

$cms = require $DIR_BASE_CORE . '/bootstrap/start.php';

$app = new \Concrete\Core\Console\Application();
$cms->instance('console', $app);
if ($cms->isInstalled()) {
    $cms->setupPackageAutoloaders();
    $cms->setupPackages();
}
$app->setupDefaultCommands();

\Events::dispatch('on_before_console_run');

$app->run();

\Events::dispatch('on_after_console_run');

Fix CLI run with symlinked core directory under Windows


<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\TextUI\XmlConfiguration;

use DOMDocument;
use DOMElement;

/**
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
 */
final class IntroduceCoverageElement implements Migration
{
    /**
     * @var DOMDocument
     */
    private $document;

    /**
     * @var DOMElement
     */
    private $coverage;

    public function migrate(DOMDocument $document): void
    {
        $this->document = $document;
        $this->coverage = $document->createElement('coverage');

        $this->document->documentElement->insertBefore(
            $this->coverage,
            $this->document->documentElement->firstChild
        );
    }
}

<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\TextUI\XmlConfiguration;

use DOMDocument;
use DOMElement;

/**
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
 */
final class IntroduceCoverageElement implements Migration
{
    public function migrate(DOMDocument $document): void
    {
        $coverage = $document->createElement('coverage');

        $document->documentElement->insertBefore(
            $coverage,
            $document->documentElement->firstChild
        );
    }
}

Use local variables instead of properties


<?php

final class PhabricatorSubtypeEditEngineExtension
  extends PhabricatorEditEngineExtension {

  const EXTENSIONKEY = 'editengine.subtype';
  const EDITKEY = 'subtype';

  public function getExtensionPriority() {
    return 8000;
  }

  public function isExtensionEnabled() {
    return true;
  }

  public function getExtensionName() {
    return pht('Subtypes');
  }

  public function supportsObject(
    PhabricatorEditEngine $engine,
    PhabricatorApplicationTransactionInterface $object) {
    return $engine->supportsSubtypes();
  }

  public function buildCustomEditFields(
    PhabricatorEditEngine $engine,
    PhabricatorApplicationTransactionInterface $object) {

    $subtype_type = PhabricatorTransactions::TYPE_SUBTYPE;

    $map = $object->newEditEngineSubtypeMap();
    $options = mpull($map, 'getName');

    $subtype_field = id(new PhabricatorSelectEditField())
      ->setKey(self::EDITKEY)
      ->setLabel(pht('Subtype'))
      ->setIsConduitOnly(true)
      ->setIsHidden(true)
      ->setIsReorderable(false)
      ->setIsDefaultable(false)
      ->setIsLockable(false)
      ->setTransactionType($subtype_type)
      ->setConduitDescription(pht('Change the object subtype.'))
      ->setConduitTypeDescription(pht('New object subtype key.'))
      ->setValue($object->getEditEngineSubtype())
      ->setOptions($options);

    return array(
      $subtype_field,
    );
  }

}

<?php

final class PhabricatorSubtypeEditEngineExtension
  extends PhabricatorEditEngineExtension {

  const EXTENSIONKEY = 'editengine.subtype';
  const EDITKEY = 'subtype';

  public function getExtensionPriority() {
    return 8000;
  }

  public function isExtensionEnabled() {
    return true;
  }

  public function getExtensionName() {
    return pht('Subtypes');
  }

  public function supportsObject(
    PhabricatorEditEngine $engine,
    PhabricatorApplicationTransactionInterface $object) {
    return $engine->supportsSubtypes();
  }

  public function buildCustomEditFields(
    PhabricatorEditEngine $engine,
    PhabricatorApplicationTransactionInterface $object) {

    $subtype_type = PhabricatorTransactions::TYPE_SUBTYPE;

    $map = $object->newEditEngineSubtypeMap();
    $options = mpull($map, 'getName');

    $subtype_field = id(new PhabricatorSelectEditField())
      ->setKey(self::EDITKEY)
      ->setLabel(pht('Subtype'))
      ->setIsConduitOnly(true)
      ->setIsHidden(true)
      ->setIsReorderable(false)
      ->setIsDefaultable(false)
      ->setIsLockable(false)
      ->setTransactionType($subtype_type)
      ->setConduitDescription(pht('Change the object subtype.'))
      ->setConduitTypeDescription(pht('New object subtype key.'))
      ->setValue($object->getEditEngineSubtype())
      ->setOptions($options);

    // If subtypes are configured, enable changing them from the bulk editor.
    if (count($map) > 1) {
      $subtype_field->setBulkEditLabel(pht('Change subtype to'));
    }

    return array(
      $subtype_field,
    );
  }

}

Allow object subtypes to be changed via bulk editor

Summary:
Ref T13151. See PHI683. Ref T12314.

You can currently change object subtypes via Conduit (`maniphest.edit`) but not via the web UI.

Changing object subtypes is inherently a somewhat-perilous operation that likely has a lot of rough edges we'll need to smooth over eventually, mostly around changing an object from subtype X to subtype Y, where some field exists on one but not the other. This isn't a huge issue, just not entirely intuitive.

It should also, in theory, be fairly rare.

As a reasonable middle ground, provide web UI access via the bulk editor. This makes it possible, but doesn't clutter the UI up with a rarely-used option with rough edges.

Test Plan:
  - With subtypes not configured, saw a normal bulk editor with no new option.
  - With subtypes configured, swapped tasks subtypes via bulk editor.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13151, T12314

Differential Revision: https://secure.phabricator.com/D19490


<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

return [
    'whitelist' => [
        'PHPUnit\*',
        'SebastianBergmann\CodeCoverage\*',
        'PHP_Token*',
        'Prophecy\*',
    ],
];

<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

return [
    'whitelist' => [
        'PHPUnit\*',
        'Prophecy\*',
    ],
];

Remove PHP_Token and CodeCoverage from whitelist

Since CodeCoverage and PHP_Token are not part of the public API of
PHPUnit they can safely be removed from the whitelist.

Issue #3750


<?php
/**
 * Created by Florian Pradines
 */

namespace Skeerel\Util;

use Skeerel\Exception\IllegalArgumentException;
use Skeerel\Exception\SessionNotStartedException;

class Session
{
    public static function isValidName($sessionName) {
        return is_string($sessionName) && preg_match('/^[a-zA-Z_-][a-zA-Z0-9_-]*$', $sessionName) === 1;
    }

    public static function isSessionStarted() {
        return function_exists('session_status') ? PHP_SESSION_ACTIVE === session_status() : !empty(session_id());
    }

    public static function get($name) {
        if (!self::isSessionStarted()) {
            throw new SessionNotStartedException();
        }

        if (!self::isValidName($name)) {
            throw new IllegalArgumentException("the name of the session parameter must be a valid string name");
        }

        return $_SESSION[$name];
    }

    public static function set($name, $value) {
        if (!self::isSessionStarted()) {
            throw new SessionNotStartedException();
        }

        if (!self::isValidName($name)) {
            throw new IllegalArgumentException("the name of the session parameter must be a valid string name");
        }

        if (!is_string($value)) {
            throw new IllegalArgumentException("the value of the session parameter must be a string");
        }

        $_SESSION[$name] = $value;
    }
}

<?php
/**
 * Created by Florian Pradines
 */

namespace Skeerel\Util;

use Skeerel\Exception\IllegalArgumentException;
use Skeerel\Exception\SessionNotStartedException;

class Session
{
    public static function isValidName($sessionName) {
        return is_string($sessionName) && preg_match('/^[a-zA-Z_-][a-zA-Z0-9_-]*$', $sessionName) === 1;
    }

    public static function isSessionStarted() {
        if (function_exists('session_status')) {
            return PHP_SESSION_ACTIVE === session_status();
        }

        // arbitrary expressions are only allowed since php 5.5
        $sessionId = session_id();
        return !empty($sessionId);
    }

    public static function get($name) {
        if (!self::isSessionStarted()) {
            throw new SessionNotStartedException();
        }

        if (!self::isValidName($name)) {
            throw new IllegalArgumentException("the name of the session parameter must be a valid string name");
        }

        return $_SESSION[$name];
    }

    public static function set($name, $value) {
        if (!self::isSessionStarted()) {
            throw new SessionNotStartedException();
        }

        if (!self::isValidName($name)) {
            throw new IllegalArgumentException("the name of the session parameter must be a valid string name");
        }

        if (!is_string($value)) {
            throw new IllegalArgumentException("the value of the session parameter must be a string");
        }

        $_SESSION[$name] = $value;
    }
}

Fix for PHP < 5.5

Fix for PHP < 5.5


<?php

namespace Finite\Transition;

use  Finite\StateMachine\StateMachine;

/**
 * The base Transition interface
 *
 * @author Yohan Giarelli <yohan@frequence-web.fr>
 */
interface TransitionInterface
{
    /**
     * Returns the array of states that supports this transition
     *
     * @return array
     */
    public function getInitialStates();

    /**
     * Returns the state resulting of this transition
     *
     * @return string
     */
    public function getState();

    /**
     * Process the transition
     *
     * @param StateMachine $stateMachine
     *
     * @return mixed
     */
    public function process(StateMachine $stateMachine);

    /**
     * Returns the name of the transition
     *
     * @return string
     */
    public function getName();

    /**
     * Returns the closure. If closure execution returns false, transition cannot be applied.
     *
     * @return callable
     */
    public function getGuard();
}

<?php

namespace Finite\Transition;

use  Finite\StateMachine\StateMachineInterface;

/**
 * The base Transition interface
 *
 * @author Yohan Giarelli <yohan@frequence-web.fr>
 */
interface TransitionInterface
{
    /**
     * Returns the array of states that supports this transition
     *
     * @return array
     */
    public function getInitialStates();

    /**
     * Returns the state resulting of this transition
     *
     * @return string
     */
    public function getState();

    /**
     * Process the transition
     *
     * @param StateMachineInterface $stateMachine
     *
     * @return mixed
     */
    public function process(StateMachineInterface $stateMachine);

    /**
     * Returns the name of the transition
     *
     * @return string
     */
    public function getName();

    /**
     * Returns the closure. If closure execution returns false, transition cannot be applied.
     *
     * @return callable
     */
    public function getGuard();
}

Fix process params to only accept StateMachine

It must accept all class that implement StateMachineInterface


Use user instead of name

Use user instead of name


<?php
/**
 * @author    Andrew Coulton <andrew@ingenerator.com>
 * @licence   BSD-3-Clause
 */

namespace Ingenerator\BehatTableAssert;

/**
 * @package Ingenerator\BehatTableAssert
 */
class TableAssertionFailureException extends \RuntimeException
{
    /**
     * @var array
     */
    protected $diff;

    /**
     * @var string
     */
    protected $diff_string;

    /**
     * @param string $message
     * @param array  $diff
     * @param string $diff_string
     */
    public function __construct($message, array $diff, $diff_string)
    {
        $this->diff        = $diff;
        $this->diff_string = $diff_string;
        parent::__construct($message);
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return $this->getMessage()."\n\n".$this->diff_string;
    }

    /**
     * @return array
     */
    public function getDiff()
    {
        return $this->diff;
    }

    /**
     * @return string
     */
    public function getDiffString()
    {
        return $this->diff_string;
    }

}

<?php
/**
 * @author    Andrew Coulton <andrew@ingenerator.com>
 * @licence   BSD-3-Clause
 */

namespace Ingenerator\BehatTableAssert;

/**
 * @package Ingenerator\BehatTableAssert
 */
class TableAssertionFailureException extends \RuntimeException
{
    /**
     * @var array
     */
    protected $diff;

    /**
     * @var string
     */
    protected $diff_string;

    /**
     * @param string $message
     * @param array  $diff
     * @param string $diff_string
     */
    public function __construct($message, array $diff, $diff_string)
    {
        $this->diff        = $diff;
        $this->diff_string = $diff_string;
        parent::__construct($message."\n\n".$this->diff_string);
    }

    /**
     * @return array
     */
    public function getDiff()
    {
        return $this->diff;
    }

    /**
     * @return string
     */
    public function getDiffString()
    {
        return $this->diff_string;
    }

}

Include full table diff string in the exception message

Otherwise it doesn't get rendered in behat reports etc unless in
verbose mode, which turns out to be not that useful.


<?php

namespace Flowcode\ClassificationBundle\Service;

/**
 * CategoryService
 */
class CategoryService{

	private $container;

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

	public function findByRoot($root = null)
	{
		$repo = $this->container->get('doctrine.orm.entity_manager')
				->getRepository('AmulenClassificationBundle:Category');

		$root = $repo->findBy(array("name" => $root));
		return $repo->findBy(array("root" => $root));
	}
}

<?php

namespace Flowcode\ClassificationBundle\Service;

/**
 * CategoryService
 */
class CategoryService{

	private $container;

	public function __construct($container)
	{
		$this->container = $container;
	}
	public function findByRootFirstLevelItems($root = null)
	{
		$repo = $this->container->get('doctrine.orm.entity_manager')
				->getRepository('AmulenClassificationBundle:Category');

		$root = $repo->findBy(array("name" => $root));
		if(count($root) > 0){
			return $root[0]->getChildren();
		}
		return array();
	}
	public function findByRoot($root = null)
	{
		$repo = $this->container->get('doctrine.orm.entity_manager')
				->getRepository('AmulenClassificationBundle:Category');

		$root = $repo->findBy(array("name" => $root));
		return $repo->findBy(array("root" => $root));
	}
}

Add new service on categoryService, get all first level


<?php namespace Aedart\Scaffold\Contracts\Builders;

/**
 * Builder
 *
 * A scaffold builder is responsible for creating a
 * specified directory structure, copy files into
 * the project folder and generate files based on
 * available templates.
 *
 * @author Alin Eugen Deac <aedart@gmail.com>
 * @package Aedart\Scaffold\Contracts\Builders
 */
interface Builder {

}

<?php namespace Aedart\Scaffold\Contracts\Builders;

/**
 * Builder
 *
 * A scaffold builder is responsible for creating a
 * specified directory structure, copy files into
 * the project folder and generate files based on
 * available templates.
 *
 * @author Alin Eugen Deac <aedart@gmail.com>
 * @package Aedart\Scaffold\Contracts\Builders
 */
interface Builder {

    public function createDirectories();
    public function copyFiles();
    public function generateFiles();

}

Add core methods for the builder

Add core methods for the builder

Create directories, copy files and generate files are the main
responsibilities for a Scaffold builder


<?php

namespace MssPhp\Schema\Response;

use JMS\Serializer\Annotation\Type;

class Properties {
    /**
     * @Type("integer")
     */
    public $area;

    /**
     * @Type("integer")
     */
    public $bed_rooms;

    /**
     * @Type("integer")
     */
    public $living_rooms;

    /**
     * @Type("integer")
     */
    public $dining_rooms;

    /**
     * @Type("integer")
     */
    public $bath_rooms;

    /**
     * @Type("integer")
     */
    public $wc_rooms;

    /**
     * @Type("integer")
     */
    public $min;

    /**
     * @Type("integer")
     */
    public $max;

    /**
     * @Type("integer")
     */
    public $std;
}

<?php

namespace MssPhp\Schema\Response;

use JMS\Serializer\Annotation\Type;

class Properties {
    /**
     * @Type("integer")
     */
    public $area;

    /**
     * @Type("integer")
     */
    public $bed_rooms;

    /**
     * @Type("integer")
     */
    public $living_rooms;

    /**
     * @Type("integer")
     */
    public $dining_rooms;

    /**
     * @Type("integer")
     */
    public $bath_rooms;

    /**
     * @Type("integer")
     */
    public $wc_rooms;

    /**
     * @Type("integer")
     */
    public $min;

    /**
     * @Type("integer")
     */
    public $max;

    /**
     * @Type("integer")
     */
    public $std;

    /**
     * @Type("integer")
     */
    public $mfp;
}

Add min full payer to properties too

Add min full payer to properties too


<?php
namespace Edujugon\GoogleAds\Console;

use Edujugon\GoogleAds\Auth\OAuth2;
use Illuminate\Console\Command;

class RefreshTokenCommand extends Command {

    /**
     * Console command signature
     *
     * @var string
     */
    protected $signature = 'googleads:token:generate';

    /**
     * Description
     *
     * @var string
     */
    protected $description = 'Generate a new refresh token for Google Adwords API';

    /**
     * Generate refresh token
     *
     */
    public function handle()
    {

        $oAth2 = (new OAuth2())->build();

        $authorizationUrl = $oAth2->buildFullAuthorizationUri();

        // Show authorization URL
        $this->line(sprintf(
            "Log into the Google account you use for AdWords and visit the following URL:\n%s",
            $authorizationUrl
        ));
        // Retrieve token
        $accessToken = $this->ask('After approving the token enter the authorization code here:');

        $oAth2->setCode($accessToken);
        $authToken = $oAth2->fetchAuthToken();

        $this->comment('Copy the refresh token in your googleads configuration file (config/google-ads.php)');
        // Print refresh token
        $this->line(sprintf(
            'Refresh token: "%s"',
            $authToken['refresh_token']
        ));
    }

}

<?php
namespace Edujugon\GoogleAds\Console;

use Edujugon\GoogleAds\Auth\OAuth2;
use Illuminate\Console\Command;

class RefreshTokenCommand extends Command {

    /**
     * Console command signature
     *
     * @var string
     */
    protected $signature = 'googleads:token:generate';

    /**
     * Description
     *
     * @var string
     */
    protected $description = 'Generate a new refresh token for Google Adwords API';

    /**
     * Generate refresh token
     *
     */
    public function handle()
    {

        $oAth2 = (new OAuth2())->build();

        $authorizationUrl = $oAth2->buildFullAuthorizationUri();

        // Show authorization URL
        $this->line(sprintf(
            "Log into the Google account you use for AdWords and visit the following URL:\n%s",
            $authorizationUrl
        ));
        // Retrieve token
        $accessToken = $this->ask('After approving the token enter the authorization code here:');

        $oAth2->setCode($accessToken);
        $authToken = $oAth2->fetchAuthToken();

        if (!array_key_exists('refresh_token', $authToken)) {
            $this->error('Couldn\'t find refresh_token key in the response.');
            $this->comment('Below you can check the whole response:');
            $this->line(json_encode($authToken));

            return;
        }

        $this->comment('Copy the refresh token in your googleads configuration file (config/google-ads.php)');

        // Print refresh token
        $this->line(sprintf(
            'Refresh token: "%s"',
            $authToken['refresh_token']
        ));
    }

}

Add control when creating a new refresh token and there is no refresh_token key in the response


<?php
/**
 * Go! OOP&AOP PHP framework
 *
 * @copyright     Copyright 2012, Lissachenko Alexander <lisachenko.it@gmail.com>
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */

namespace Go\Lang\Annotation;

/**
 * Pointcut annotation
 *
 * @Annotation
 * @Target("METHOD")
 */
class Pointcut extends BaseAnnotation
{

}

<?php
/**
 * Go! OOP&AOP PHP framework
 *
 * @copyright     Copyright 2012, Lissachenko Alexander <lisachenko.it@gmail.com>
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */

namespace Go\Lang\Annotation;

/**
 * Pointcut annotation
 *
 * @Annotation
 * @Target("METHOD")
 */
class Pointcut extends BaseAnnotation
{
    /**
     * Identifier of pointcut
     *
     * @var string
     */
    public $id = null;
}

Add id property to the pointcut annotation