<?php namespace Orchestra\Foundation;

use Illuminate\Events\EventServiceProvider;
use Orchestra\Routing\RoutingServiceProvider;
use Illuminate\Foundation\Application as Foundation;
use Orchestra\Contracts\Foundation\DeferrableServiceContainer;

class Application extends Foundation implements DeferrableServiceContainer
{
    /**
     * Register all of the base service providers.
     *
     * @return void
     */
    protected function registerBaseServiceProviders()
    {
        $this->register(new EventServiceProvider($this));

        $this->register(new RoutingServiceProvider($this));
    }

    /**
     * Get the application's deferred services.
     *
     * @return array
     */
    public function getDeferredServices()
    {
        return $this->deferredServices;
    }
}

<?php namespace Orchestra\Foundation;

use Illuminate\Events\EventServiceProvider;
use Orchestra\Routing\RoutingServiceProvider;
use Illuminate\Foundation\Application as BaseApplication;
use Orchestra\Contracts\Foundation\DeferrableServiceContainer;

class Application extends BaseApplication implements DeferrableServiceContainer
{
    /**
     * Register all of the base service providers.
     *
     * @return void
     */
    protected function registerBaseServiceProviders()
    {
        $this->register(new EventServiceProvider($this));

        $this->register(new RoutingServiceProvider($this));
    }

    /**
     * Get the application's deferred services.
     *
     * @return array
     */
    public function getDeferredServices()
    {
        return $this->deferredServices;
    }
}

Update import to avoid conflict.

Update import to avoid conflict.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

namespace Oro\Bundle\UserBundle\Tests\Unit\Entity;

use Oro\Bundle\UserBundle\Entity\Role;

class RoleTest extends \PHPUnit_Framework_TestCase
{
    public function testCreate()
    {
        $strRole = 'foo';
        $role = new Role($strRole);

        $this->assertEquals($strRole, $role->getLabel());
        $this->assertEquals($strRole, $role->getRole());
    }

    public function testRole()
    {
        $role = new Role();

        $this->assertEmpty($role->getId());
        $this->assertEmpty($role->getRole());

        $role->setRole('foo');

        $this->assertStringStartsWith('ROLE_FOO', $role->getRole());
        $this->assertEquals(Role::PREFIX_ROLE, $role->getPrefix());
    }

    public function testLabel()
    {
        $role = new Role();
        $label = 'Test role';

        $this->assertEmpty($role->getLabel());

        $role->setLabel($label);

        $this->assertEquals($label, $role->getLabel());
        $this->assertEquals($label, (string)$role);
    }

    public function testClone()
    {
        $role = new Role();

        $class = new \ReflectionClass($role);
        $prop  = $class->getProperty('id');
        $prop->setAccessible(true);
        $prop->setValue($role, 1);

        $copy = clone $role;
        $this->assertEmpty($copy->getId());
    }
}

BB-3603: Add new flag to the role entity
- removed unneseccary empty line


<?php

namespace App\Sharp\Commands;

use Code16\Sharp\EntityList\Commands\InstanceCommand;

class SpaceshipExternalLink extends InstanceCommand
{
    public function label(): string
    {
        return "A Link";
    }

    public function execute($instanceId, array $data = []): array
    {
        return $this->link(
            route('code16.sharp.edit',
                [
                    'entityKey' => 'spaceship',
                    'instanceId' => $instanceId
                ]
            )
        );
    }
}

<?php

namespace App\Sharp\Commands;

use Code16\Sharp\EntityList\Commands\InstanceCommand;
use Code16\Sharp\Utils\Links\LinkToForm;

class SpaceshipExternalLink extends InstanceCommand
{
    public function label(): string
    {
        return "A Link to the Form";
    }

    public function execute($instanceId, array $data = []): array
    {
        return $this->link(
            LinkToForm::make('spaceship', $instanceId)->renderAsUrl()
        );
    }
}

Fix Saturn link command example

Fix Saturn link command example


<?php

$id = Router::$parameters['{id}'];

$image = Image::ROW($id);
if (null == $image) {
	exit();
}

$parts = Router::$parts;

if (0 == count($parts)) {
	$path = Rack::Path('img', md5($image->getId()));
} elseif (1 == count($parts)) {
	$transformation = $parts[0];
	$hash = md5($transformation);
	$path = Rack::Path('img.cache', $hash);
	if (!file_exists($path)) {
		Rack::Make('img.cache', $hash);
		$prim = Prim::transform($image);
		$prim->setRules($transformation);
		$prim->saveTo($path);
	}
} else {
	exit;
}

header("Expires: ".date("r", time()+9999999));
header("Content-type: ".$image->getMime());
header("Content-Length: ". filesize($path));
readfile($path);

<?php

$id = Router::$parameters['{id}'];

$image = Image::ROW($id);
if (null == $image) {
	exit();
}

$parts = Router::$parts;

if (0 == count($parts)) {
	$path = Rack::Path('img', md5($image->getId()));
} elseif (1 == count($parts)) {
	$transformation = $parts[0];
	$hash = md5(Router::$url);
	$path = Rack::Path('img.cache', $hash);
	if (!file_exists($path)) {
		Rack::Make('img.cache', $hash);
		$prim = Prim::transform($image);
		$prim->setRules($transformation);
		$prim->saveTo($path);
	}
} else {
	exit;
}

header("Expires: ".date("r", time()+9999999));
header("Content-type: ".$image->getMime());
header("Content-Length: ". filesize($path));
readfile($path);

Fix bug in resizing images module

Fix bug in resizing images module


<?php

return [

    'index' => 'sites',
    'body'  => [
        'mapping' => [
            'default' => [
                'properties' => [
                    'title'   => ['type' => 'string'],
                    'content' => ['type' => 'string'],
                    'hash_id' => ['type' => 'string', 'index' => 'not_analyzed'],
                    'original' => [
                        'type' => 'object',
                        'properties' => [
                            'title' => ['type' => 'string', 'index' => 'not_analyzed'],
                            'content' => ['type' => 'string', 'index' => 'not_analyzed'],
                        ]
                    ]
                ]
            ]
        ]
    ]

];

<?php

return [

    'index' => 'sites',
    'body'  => [
        'mapping' => [
            'default' => [
                'properties' => [
                    'title'    => ['type' => 'string'],
                    'content'  => ['type' => 'string'],
                    'hash_id'  => ['type' => 'string', 'index' => 'not_analyzed'],
                    'original' => [
                        'type'       => 'object',
                        'properties' => [
                            'title'   => ['type' => 'string', 'index' => 'not_analyzed'],
                            'content' => ['type' => 'string', 'index' => 'not_analyzed'],
                            'url'     => ['type' => 'string', 'index' => 'not_analyzed'],
                            'date'    => ['type' => 'date', 'format' => 'date_time_no_millis']
                        ]
                    ]
                ]
            ]
        ]
    ]

];

Update index mapping adding url and date


<?php

namespace wcf\action;

use wcf\system\background\BackgroundQueueHandler;
use wcf\system\WCF;

/**
 * Performs background queue jobs.
 *
 * @author  Tim Duesterhus
 * @copyright   2001-2019 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\Action
 * @since   3.0
 */
class BackgroundQueuePerformAction extends AbstractAction
{
    /**
     * number of jobs that will be processed per invocation
     * @var int
     */
    public static $jobsPerRun = 5;

    /**
     * @inheritDoc
     */
    public function execute()
    {
        parent::execute();

        \header('Content-type: application/json; charset=UTF-8');
        for ($i = 0; $i < self::$jobsPerRun; $i++) {
            if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
                // there were no more jobs
                break;
            }
        }
        echo BackgroundQueueHandler::getInstance()->getRunnableCount();
        WCF::getSession()->deleteIfNew();

        exit;
    }
}

<?php

namespace wcf\action;

use Laminas\Diactoros\Response\JsonResponse;
use wcf\system\background\BackgroundQueueHandler;
use wcf\system\WCF;

/**
 * Performs background queue jobs.
 *
 * @author  Tim Duesterhus
 * @copyright   2001-2019 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\Action
 * @since   3.0
 */
class BackgroundQueuePerformAction extends AbstractAction
{
    /**
     * number of jobs that will be processed per invocation
     * @var int
     */
    public static $jobsPerRun = 5;

    /**
     * @inheritDoc
     */
    public function execute()
    {
        parent::execute();

        for ($i = 0; $i < self::$jobsPerRun; $i++) {
            if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
                // there were no more jobs
                break;
            }
        }

        WCF::getSession()->deleteIfNew();

        return new JsonResponse(
            BackgroundQueueHandler::getInstance()->getRunnableCount()
        );
    }
}

Use PSR-7 responses in BackgroundQueuePerformAction


<?php

namespace pub;

use Symfony\Component\Yaml;
use Illuminate\Filesystem\Filesystem;

/**
 * Class Project Config
 *
 * Manages our project-config.yml for project based configuration.
 *
 * @package pub
 */
class ProjectConfig {

  // TODO: Figure out how to make this work with symfony2 finder depth.
  // based on my testing there's a bug I need to track down in the Finder component.
  // for now it's easier ot just hard-code it.
  public $project_config_file = 'project-config.yml';
  public $settings = NULL;

  /**
   * Returns TRUE or FALSE based on the config file existing.
   *
   * @return bool
   */
  public function exists() {
    $retval = FALSE;
    $fs = new Filesystem();

    if ($fs->exists($this->project_config_file)) {
      $retval = TRUE;
    }

    return $retval;
  }

  /**
   * Load the Project config yaml into memory.
   *
   * @return mixed
   * @throws \Exception
   */
  public function load() {
    $fs = new Filesystem();
    $yaml = new Yaml\Parser();

    if (!$this->exists()) {
      throw new \Exception("{$this->project_config_file} does not exists");
    }

    $this->settings = $yaml->parse($fs->get($this->project_config_file));

    return $this->settings;
  }
}

<?php

namespace pub;

use Symfony\Component\Yaml;
use Illuminate\Filesystem\Filesystem;

/**
 * Class Project Config
 *
 * Manages our project-config.yml for project based configuration.
 *
 * @package pub
 */
class ProjectConfig {

  // TODO: Figure out how to make this work with symfony2 finder depth.
  // based on my testing there's a bug I need to track down in the Finder component.
  // for now it's easier ot just hard-code it.
  public $project_config_file = 'project-config.yml';
  public $settings = NULL;

  /**
   * Returns TRUE or FALSE based on the config file existing.
   *
   * @return bool
   */
  public function exists() {
    $retval = FALSE;
    $fs = new Filesystem();

    if ($fs->exists($this->project_config_file)) {
      $retval = TRUE;
    }
    else {
      $this->project_config_file = '../' . $this->project_config_file;
      if ($fs->exists($this->project_config_file)) {
        $retval = TRUE;
      }
    }

    return $retval;
  }

  /**
   * Load the Project config yaml into memory.
   *
   * @return mixed
   * @throws \Exception
   */
  public function load() {
    $fs = new Filesystem();
    $yaml = new Yaml\Parser();

    if (!$this->exists()) {
      throw new \Exception("{$this->project_config_file} does not exists");
    }

    $this->settings = $yaml->parse($fs->get($this->project_config_file));

    return $this->settings;
  }
}

Allow pub to be used in docroot

Allow pub to be used in docroot


<?php
/**
 * This file is part of the BootstrapBundle project.
 *
 * (c) 2013 Philipp Boes <mostgreedy@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace P2\Bundle\BootstrapBundle\Tests\DependencyInjection;
use P2\Bundle\BootstrapBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\Processor;

/**
 * UnitTest ConfigurationTest
 * @package P2\Bundle\BootstrapBundle\Tests\DependencyInjection
 */
class ConfigurationTest extends \PHPUnit_Framework_TestCase {
    /**
     * set up
     */
    protected function setUp()
    {
        parent::setUp();
    }

    /**
     * tear down
     */
    protected function tearDown()
    {
        parent::tearDown();
    }

    /**
     * @covers P2\Bundle\BootstrapBundle\DependencyInjection\Configuration::getConfigTreeBuilder
     * @group s
     */
    public function testGetConfigTreeBuilder()
    {
        $processor = new Processor();
        $configuration = new Configuration(array());
        $config = $processor->processConfiguration($configuration, array(array()));

        $this->assertArrayHasKey('jquery_path', $config);
        $this->assertArrayHasKey('source_path', $config);
        $this->assertArrayHasKey('themes_path', $config);
        $this->assertArrayHasKey('public_path', $config);
        $this->assertArrayHasKey('bootstrap_css', $config);
        $this->assertArrayHasKey('bootstrap_js', $config);
        $this->assertArrayHasKey('jquery_js', $config);
        $this->assertArrayHasKey('holder_js', $config);
    }
}

<?php
/**
 * This file is part of the BootstrapBundle project.
 *
 * (c) 2013 Philipp Boes <mostgreedy@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace P2\Bundle\BootstrapBundle\Tests\DependencyInjection;
use P2\Bundle\BootstrapBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\Processor;

/**
 * UnitTest ConfigurationTest
 * @package P2\Bundle\BootstrapBundle\Tests\DependencyInjection
 */
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers P2\Bundle\BootstrapBundle\DependencyInjection\Configuration::getConfigTreeBuilder
     * @group s
     */
    public function testGetConfigTreeBuilder()
    {
        $processor = new Processor();
        $configuration = new Configuration(array());
        $config = $processor->processConfiguration($configuration, array(array()));

        $this->assertArrayHasKey('jquery_path', $config);
        $this->assertArrayHasKey('source_path', $config);
        $this->assertArrayHasKey('themes_path', $config);
        $this->assertArrayHasKey('public_path', $config);
        $this->assertArrayHasKey('bootstrap_css', $config);
        $this->assertArrayHasKey('bootstrap_js', $config);
        $this->assertArrayHasKey('jquery_js', $config);
        $this->assertArrayHasKey('holder_js', $config);
    }
}

Remove setup and tear down from configuration test


<?php

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

class CreateUsersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('users', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('name');
			$table->string('email')->unique()->nullable();
			$table->string('password', 60);
			$table->string('avatar')->nullable();
			$table->boolean('blocked')->default(false)->index();
			$table->integer('topic_count')->default(0)->index();
			$table->integer('reply_count')->default(0)->index();
			$table->integer('notification_count')->default(0);
			$table->string('city')->nullable();
			$table->string('website')->nullable();
			$table->string('signature')->nullable();
			$table->string('introduction')->nullable();
			$table->rememberToken();
			$table->softDeletes();
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('users');
	}

}

<?php

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

class CreateUsersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('users', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('name');
			$table->string('email')->unique()->nullable();
			$table->string('password', 60);
			$table->string('avatar')->nullable();
			$table->boolean('blocked')->default(false)->index();
            $table->integer('treasure')->default(0)->index();
			$table->integer('topic_count')->default(0)->index();
			$table->integer('reply_count')->default(0)->index();
			$table->integer('notification_count')->default(0);
			$table->string('city')->nullable();
			$table->string('website')->nullable();
			$table->string('signature')->nullable();
			$table->string('introduction')->nullable();
			$table->rememberToken();
			$table->softDeletes();
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('users');
	}

}

Add the treasure column to the users table to measure how active a user is.


<?php
    include_once 'models/curl.php';
    include_once 'models/grader/serializer.php';
    include_once 'models/grader/bot.php';

    class Grader {
        public $bots;
        public $registeredBots;
        protected $game;

        public function initiate() {
            $this->registeredBots = [];
            foreach ( $this->bots as $bot ) {
                try {
                    $bot->sendInitiateRequest();
                    $this->registeredBots[] = $bot;
                }
                catch ( GraderBotException $e ) {
                }
            }
        }
        public function createGame() {
            foreach ( $this->bots as $bot ) {
                $bot->sendGameRequest( $this->game );
            }
        }
        public function nextRound() {
            $round = $this->game->getCurrentRound();
            foreach ( $this->bots as $bot ) {
                $bot->sendRoundRequest( $round );
            }
        }
    }
?>

<?php
    include_once 'models/curl.php';
    include_once 'models/grader/serializer.php';
    include_once 'models/grader/bot.php';

    class Grader {
        public $registeredBots;
        protected $game;
        protected $users;
        protected $bots = [];

        public function __construct( $users, $game ) {
            $this->users = $users;
            foreach ( $users as $user ) {
                $this->bots[] = new GraderBot( $user );
            }
            $this->game = $game;
        }
        public function initiate() {
            $this->registeredBots = [];
            foreach ( $this->bots as $bot ) {
                try {
                    $bot->sendInitiateRequest();
                    $this->registeredBots[] = $bot;
                }
                catch ( GraderBotException $e ) {
                }
            }
        }
        public function createGame() {
            $this->game->users = $this->users;
            $this->game->save();

            foreach ( $this->registeredBots as $bot ) {
                $bot->sendGameRequest( $this->game );
            }
        }
        public function nextRound() {
            $round = $this->game->getCurrentRound();

            foreach ( $this->registeredBots as $bot ) {
                $bot->sendRoundRequest( $round );
            }
        }
    }
?>

Add construct and make bots attribute protected


<?php

use Galahad\LaravelAddressing\LaravelAddressing;

/**
 * Class LaravelAddressingTest
 *
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class LaravelAddressingTest extends PHPUnit_Framework_TestCase
{
    public function testGettingUS()
    {
        $addressing = new LaravelAddressing();
        $usCode = $addressing->getCountryByCode('US');
        $usName = $addressing->getCountryByName('United States');

        $this->assertEquals($usCode->getName(), 'United States');
        $this->assertEquals($usName->getCode(), 'US');
    }

    public function testCountryList()
    {
        $addressing = new LaravelAddressing();
        $countries = $addressing->getCountries(LaravelAddressing::ARRAY_LIST);

        $this->assertEquals($countries['US'], 'United States');
        $this->assertEquals($countries['BR'], 'Brazil');
    }

    public function testCountryWithShortcuts()
    {
        $maker = new LaravelAddressing();

        $this->assertEquals($maker->country('US')->name, 'United States');
        $this->assertEquals($maker->country('CA')->name, 'Canada');
    }

    public function testLocale()
    {
        $maker = new LaravelAddressing('pt');

        $this->assertEquals($maker->country('US')->name, 'Estados Unidos');
        $this->assertEquals($maker->country('CA')->name, 'Canadá');
    }
}

<?php

use Galahad\LaravelAddressing\Entity\Country;
use Galahad\LaravelAddressing\LaravelAddressing;

/**
 * Class LaravelAddressingTest
 *
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class LaravelAddressingTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var LaravelAddressing
     */
    protected $addressing;

    /**
     * Setup the LaravelAddressing instance
     */
    protected function setUp()
    {
        $this->addressing = new LaravelAddressing();
    }

    /**
     * Testing the returning type of the country() method
     */
    public function testCountryMethodReturningType()
    {
        $country = $this->addressing->country('US');
        $this->assertTrue($country instanceof Country);
    }

    /**
     * Testing if the country has the correct name
     */
    public function testCountryMethod()
    {
        $country = $this->addressing->country('US');
        $this->assertEquals($country->getName(), 'United States');
        $this->assertEquals($country->getCountryCode(), 'US');
    }
}

Add tests for country() method in LaravelAddressing class


<?php

namespace ATP;

class Module
{
	protected $_moduleName = "";

    public function onBootstrap(\Zend\Mvc\MvcEvent $e)
    {
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new \Zend\Mvc\ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);
    }

    public function getConfig()
    {
        return include "module/{$this->_moduleName}/config/module.config.php";
    }

    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    $this->_moduleName => "module/{$this->_moduleName}/src/{$this->_moduleName}",
                ),
            ),
        );
    }
}

<?php

namespace ATP;

class Module
{
	protected $_moduleName = "";
	protected $_moduleBaseDir = "vendor";

    public function onBootstrap(\Zend\Mvc\MvcEvent $e)
    {
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new \Zend\Mvc\ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);
    }

    public function getConfig()
    {
        return include "{$this->_moduleBaseDir}/{$this->_moduleName}/config/module.config.php";
    }

    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    $this->_moduleName => "{$this->_moduleBaseDir}/{$this->_moduleName}/src/{$this->_moduleName}",
                ),
            ),
        );
    }
}

Allow modules to set base dir name

Allow modules to set base dir name


<?php

namespace MartiAdrogue\SqlBuilder\Test;

use Mockery;
use MartiAdrogue\SqlBuilder\SelectBuilder;
use MartiAdrogue\SqlBuilder\FromBuilder;
use MartiAdrogue\SqlBuilder\Exception\InvalidSqlSyntaxException;

class FromBuilderTest extends \PHPUnit_Framework_TestCase
{
    private $fromBuilder;

    public function setUp()
    {
        $selectBuilder = Mockery::mock(SelectBuilder::class);
        $selectBuilder->shouldReceive('__toString')->times(1)->andReturn('SELECT row1, row2, row3, row4');
        $this->fromBuilder = new FromBuilder($selectBuilder);
    }

    /**
     * @test
     */
    public function shouldReturnAFullSelectStatementAccordingWithSql92Standard()
    {
        $selectSyntax = '/SELECT\s.*FROM\s\w+/';
        $sqlSelect = $this->fromBuilder->from('table');

        $this->assertRegExp(
            $selectSyntax,
            $sqlSelect->__toString(),
            'An statement SQL Select must have the specified sintax from the SQL-92 standard.'
        );
    }

    public function tearDown()
    {
        Mockery::close();
    }
}

<?php

namespace MartiAdrogue\SqlBuilder\Test;

use Mockery;
use MartiAdrogue\SqlBuilder\SelectBuilder;
use MartiAdrogue\SqlBuilder\FromBuilder;
use MartiAdrogue\SqlBuilder\JoinBuilder;
use MartiAdrogue\SqlBuilder\Exception\InvalidSqlSyntaxException;

class FromBuilderTest extends \PHPUnit_Framework_TestCase
{
    private $fromBuilder;

    public function setUp()
    {
        $selectBuilder = Mockery::mock(SelectBuilder::class);
        $selectBuilder->shouldReceive('__toString')->times(1)->andReturn('SELECT row1, row2, row3, row4');
        $this->fromBuilder = new FromBuilder($selectBuilder);
    }

    /**
     * @test
     */
    public function shouldReturnAFullSelectStatementAccordingWithSql92Standard()
    {
        $selectSyntax = '/SELECT\s.*FROM\s\w+/';
        $sqlSelect = $this->fromBuilder->from('table');

        $this->assertRegExp(
            $selectSyntax,
            $sqlSelect->__toString(),
            'An statement SQL Select must have the specified sintax from the SQL-92 standard.'
        );
    }

    /**
     * @test
     */
    public function shouldChangeStateOfFromAndReturnJoinStaementObject()
    {
        $sqlSelect = $this->fromBuilder->from('table');
        $this->assertInstanceOf(
            JoinBuilder::class,
            $sqlSelect,
            'On change the FromBuilder It must return an instance of the next Builder, JoinBuilder.'
        );
    }

    public function tearDown()
    {
        Mockery::close();
    }
}

Test to check return value

Test to check return value


<?php
/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <toby.zerner@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Flarum\Api\Serializer;

class CurrentUserSerializer extends UserSerializer
{
    /**
     * {@inheritdoc}
     */
    protected function getDefaultAttributes($user)
    {
        $attributes = parent::getDefaultAttributes($user);

        $attributes += [
            'readTime'                 => $this->formatDate($user->read_time),
            'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
            'newNotificationsCount'    => (int) $user->getNewNotificationsCount(),
            'preferences'              => (array) $user->preferences
        ];

        return $attributes;
    }
}

<?php
/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <toby.zerner@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Flarum\Api\Serializer;

class CurrentUserSerializer extends UserSerializer
{
    /**
     * {@inheritdoc}
     */
    protected function getDefaultAttributes($user)
    {
        $attributes = parent::getDefaultAttributes($user);

        $attributes += [
            'isActivated'              => $user->is_activated,
            'email'                    => $user->email,
            'readTime'                 => $this->formatDate($user->read_time),
            'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
            'newNotificationsCount'    => (int) $user->getNewNotificationsCount(),
            'preferences'              => (array) $user->preferences
        ];

        return $attributes;
    }
}

Make sure activation status/email is returned when creating a user


<?php namespace Pingpong\Admin\Http\Controllers\Auth;

use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;

class LoginController extends Controller {

    public function getIndex()
    {
        return aview('auth.login');
    }

    public function postIndex()
    {
        if (Auth::attempt(Input::only('username', 'password'), Input::has('remember')))
        {
            return app('redirect')->route('admin.home')->withSuccess('Login success');
        }

        return app('redirect')->back()->withError("Login failed");
    }

}

<?php namespace Pingpong\Admin\Http\Controllers\Auth;

use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use Pingpong\Admin\Validation\Auth\Login;

class LoginController extends Controller {

    /**
     * @var Login
     */
    protected $validator;

    /**
     * @param Login $validator
     */
    public function __construct(Login $validator)
    {
        $this->validator = $validator;
    }

    /**
     * @return mixed
     */
    public function getIndex()
    {
        return aview('auth.login');
    }

    /**
     * @return mixed
     */
    public function postIndex()
    {
        $this->validator->validate();

        if (Auth::attempt(Input::only('username', 'password'), Input::has('remember')))
        {
            return app('redirect')->route('admin.home')->withSuccess('Login success');
        }

        return app('redirect')->back()->withError("Login failed");
    }

}

Validate the login form first

Validate the login form first


<?php

$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'env_var_names' => [
        'env_key' => 'ENV_MODE',
        'debug_key' => 'DEBUG_MODE',
    ],
];
require __DIR__.'/autoload.php';

return function (array $context): void {
    echo 'Env mode ', $context['ENV_MODE'], ', debug mode ', $context['DEBUG_MODE'];
};

<?php

$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'env_var_name' => 'ENV_MODE',
    'debug_var_name' => 'DEBUG_MODE',
];
require __DIR__.'/autoload.php';

return function (array $context): void {
    if (isset($context['APP_ENV']) || isset($context['APP_DEBUG'])) {
        echo 'An error occurred on the variable name options.';
    } else {
        echo 'Env mode ', $context['ENV_MODE'], ', debug mode ', $context['DEBUG_MODE'];
    }
};

Fix test for env var names

[Runtime] Fix test for env var names


<?php

namespace Aginev\LoginActivity;

use Illuminate\Events\Dispatcher;

class LoginActivityListener
{

    /**
     * Handle user login events.
     * @param $event
     */
    public function onUserLogin($event)
    {
        LoginActivityFacade::login($event);
    }

    /**
     * Handle user logout events.
     * @param $event
     */
    public function onUserLogout($event)
    {
        LoginActivityFacade::logout($event);
    }

    /**
     * Register the listeners for the subscriber.
     *
     * @param  Dispatcher $events
     */
    public function subscribe($events)
    {
        $events->listen(
            \Illuminate\Auth\Events\Login::class,
            'Aginev\LoginActivity\LoginActivityListener@onUserLogin'
        );

        $events->listen(
            \Illuminate\Auth\Events\Logout::class,
            'Aginev\LoginActivity\LoginActivityListener@onUserLogout'
        );
    }
}

<?php

namespace Aginev\LoginActivity;

use Illuminate\Events\Dispatcher;

class LoginActivityListener
{

    /**
     * Handle user login events.
     * @param $event
     */
    public function onUserLogin($event)
    {
        LoginActivityFacade::login($event);
    }

    /**
     * Handle user logout events.
     * @param $event
     */
    public function onUserLogout($event)
    {
        LoginActivityFacade::logout($event);
    }

    /**
     * Register the listeners for the subscriber.
     *
     * @param  Dispatcher $events
     */
    public function subscribe($events)
    {
        if (config('login-activity.track_login', false)) {
            $events->listen(
                \Illuminate\Auth\Events\Login::class,
                'Aginev\LoginActivity\LoginActivityListener@onUserLogin'
            );
        }

        if (config('login-activity.track_logout', false)) {
            $events->listen(
                \Illuminate\Auth\Events\Logout::class,
                'Aginev\LoginActivity\LoginActivityListener@onUserLogout'
            );
        }
    }
}

Switch login and logout on and off

Switch login and logout on and off


@extends(config('soda.hint_path').'::layouts.inner')

@section('content')

Welcome to Soda CMS!

Soda CMS is awesome!

            Learn more

@stop

@extends(config('soda.hint_path').'::layouts.inner')

@section('content')

Welcome to Soda CMS!

This is your dashboard.

        {{--

            Learn more

        --}}

@stop

Remove cool text from dashboard because it's to "unprofessional" .-.


<?php

class SitemapXML_Controller extends Page_Controller {

    private static $url_handlers = array(
        '' => 'GetSitemapXML'
    );

    private static $allowed_actions = array(
        'GetSitemapXML'
    );

    public function init()
    {
        $this->response->addHeader("Content-Type", "application/xml");

        parent::init();

        $this->getSiteTree();
    }

    public function GetSitemapXML()
    {
        $sitemap = new ArrayData(array(
            'Pages' => $this->pages
        ));
        return $sitemap->renderWith('SitemapPages');
    }

    private function getSiteTree()
    {
        $this->pages = SiteTree::get()->filter(array(
            'ClassName:not' => 'ErrorPage'
        ));
    }
}

<?php

class SitemapXML_Controller extends Page_Controller {

    private static $url_handlers = array(
        '' => 'GetSitemapXML'
    );

    private static $allowed_actions = array(
        'GetSitemapXML'
    );

    public function init()
    {
        parent::init();
    }

    public function GetSitemapXML()
    {
        $this->response->addHeader("Content-Type", "application/xml");
        $this->getSiteTree();

        $sitemap = new ArrayData(array(
            'Pages' => $this->pages
        ));
        return $sitemap->renderWith('SitemapPages');
    }

    private function getSiteTree()
    {
        $this->pages = SiteTree::get()->filter(array(
            'ClassName:not' => 'ErrorPage'
        ));
    }
}

Move calls within Sitemap Xml controller


<?php
    session_cache_limiter(false);
    session_start();

    function store_in_session(string $key, string $value) {
        if(isset($_SESSION))
            $_SESSION[$key] = $value;
    }

    function unset_session(string $key) {
        $SESSION[$key] = ' ';
        unset($_SESSION[$key]);
    }

    function get_from_session(string $key) {
        if(isset($_SESSION))
            return $_SESSION[$key];
        else
            return false;
    }

    function generate_token(string $form_name): string {
        $token = hash("sha512", random_bytes(512));
        store_in_session($form_name, $token);
        return $token;
    }

    function validate_token(string $form_name, string $token_value): bool {
        $token = get_from_session($form_name);
        unset_session($form_name);
        return $token === $token_value;
    }
?>

<?php
    session_cache_limiter(false);
    session_start();

    function store_in_session(string $key, string $value) {
        if(isset($_SESSION))
            $_SESSION[$key] = $value;
    }

    function unset_session(string $key) {
        $_SESSION[$key] = ' ';
        unset($_SESSION[$key]);
    }

    function get_from_session(string $key) {
        if(isset($_SESSION))
            return $_SESSION[$key];
        else
            return false;
    }

    function generate_token(string $form_name): string {
        $token = hash("sha512", random_bytes(512));
        store_in_session($form_name, $token);
        return $token;
    }

    function validate_token(string $form_name, string $token_value): bool {
        $token = get_from_session($form_name);
        unset_session($form_name);
        return $token === $token_value;
    }
?>

Add missing _ in CSRF.php

Add missing _ in CSRF.php


<?php
/* This is a list of packages and versions
 * that will be used to create the PEAR folder
 * in the windows snapshot.
 * See win32/build/mkdist.php for more details
 * $Id$
 */
$packages  = array(
"PEAR"                  =>    "1.3.1",
"Mail"                  =>    "1.1.2",
"Net_SMTP"              =>    "1.2.5",
"Net_Socket"            =>    "1.0.1",
"PHPUnit"               =>    "2.0.0beta1",
"Console_Getopt"        =>    "1.2",
"DB"                    =>    "1.6.2",
"HTTP"                  =>    "1.2.3",
"Archive_Tar"           =>    "1.1",
"Pager"                 =>    "1.0.8",
"HTML_Template_IT"      =>    "1.1",
"XML_Parser"            =>    "1.0.1",
"XML_RPC"               =>    "1.1.0",
"Net_UserAgent_Detect"  =>    "1.0",
"PEAR_Frontend_Web"     =>    "0.3"
);

?>

<?php
/* This is a list of packages and versions
 * that will be used to create the PEAR folder
 * in the windows snapshot.
 * See win32/build/mkdist.php for more details
 * $Id$
 */
$packages  = array(
"PEAR"                  =>    "1.3.1",
"Mail"                  =>    "1.1.3",
"Net_SMTP"              =>    "1.2.5",
"Net_Socket"            =>    "1.0.1",
"PHPUnit"               =>    "2.0.0beta1",
"Console_Getopt"        =>    "1.2",
"DB"                    =>    "1.6.2",
"HTTP"                  =>    "1.2.3",
"Archive_Tar"           =>    "1.1",
"Pager"                 =>    "1.0.8",
"HTML_Template_IT"      =>    "1.1",
"XML_Parser"            =>    "1.0.1",
"XML_RPC"               =>    "1.1.0",
"Net_UserAgent_Detect"  =>    "1.0",
"PEAR_Frontend_Web"     =>    "0.3"
);

?>

Include Mail 1.1.3 with PHP 5.

Include Mail 1.1.3 with PHP 5.

git-svn-id: 4b064e69dc630d28214c1e1442d27300cccf8e9a@155591 c90b9560-bf6c-de11-be94-00142212c4b1


<?php

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class EsIndexDocument implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $model;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($model)
    {
        $this->model = $model;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $this->model->esIndexDocument();
    }
}

<?php

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Jobs;

use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;

class EsIndexDocument implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable;

    private array $modelMeta;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($model)
    {
        $this->modelMeta = [
            'class' => get_class($model),
            'id' => $model->getKey(),
        ];
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(): void
    {
        $id = $this->modelMeta['id'];

        if (!is_scalar($id)) {
            log_error(new Exception("can't index models with unsupported primary key: ".json_encode($id)));

            return;
        }

        $class = $this->modelMeta['class'];
        $model = $class::find($id);

        if ($model !== null) {
            $model->esIndexDocument();

            return;
        }

        $model = new $class();
        $keyName = $model->getKeyName();
        $model->setAttribute($keyName, $id);
        $model->esDeleteDocument();
    }
}

Fix handling deleted model for indexing

Fix handling deleted model for indexing


<?php

namespace Plummer\Calendar;

class CalendarFactory
{
	public static function fromRegistry(CalendarAbstract $calendar, RegistryInterface $eventsRegistry, RegistryInterface $recurrencesRegistry)
	{
		return static::fromIterator($calendar, $eventsRegistry->getIterator(), $recurrencesRegistry->getIterator());
	}

	public static function fromIterator(CalendarAbstract $calendar, \Iterator $eventsIterator, \Iterator $recurrencesIterator)
	{
		$calendar->addEventsIterator($eventsIterator);
		$calendar->addRecurrencesIterator($recurrencesIterator);

		return $calendar;
	}
}

<?php

namespace Plummer\Calendar;

class CalendarFactory
{
	public static function fromRegistry(CalendarAbstract $calendar, RegistryInterface $eventsRegistry, RegistryInterface $recurrencesRegistry)
	{
		return static::fromIterator($calendar, $eventsRegistry->getIterator(), $recurrencesRegistry->getIterator());
	}

	public static function fromIterator(CalendarAbstract $calendar, \Iterator $eventsIterator, \Iterator $recurrencesIterator)
	{
		$calendar->addEvents($eventsIterator);
		$calendar->addRecurrenceTypes($recurrencesIterator);

		return $calendar;
	}
}

Correct the add methods being called by the calendar factory.


<?php
/**
 * This file is part of the Elephant.io package
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 *
 * @copyright Wisembly
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
 */

namespace ElephantIO;

/**
 * Represents an engine used within ElephantIO to send / receive messages from
 * a websocket real time server
 *
 * @author Baptiste Clavié <baptiste@wisembly.com>
 */
interface EngineInterface
{
    /** Connect to the targeted server */
    public function connect();

    /** Closes the connection to the websocket */
    public function close();

    /** Read data from the socket */
    public function read();

    /** Sends data through the websocket */
    public function send();

    /** Keeps alive the connection */
    public function keepAlive();
}

<?php
/**
 * This file is part of the Elephant.io package
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 *
 * @copyright Wisembly
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
 */

namespace ElephantIO;

/**
 * Represents an engine used within ElephantIO to send / receive messages from
 * a websocket real time server
 *
 * @author Baptiste Clavié <baptiste@wisembly.com>
 */
interface EngineInterface
{
    const OPEN    = 0;
    const CLOSE   = 1;
    const PING    = 2;
    const PONG    = 3;
    const MESSAGE = 4;
    const UPGRADE = 5;
    const NOOP    = 6;

    /** Connect to the targeted server */
    public function connect();

    /** Closes the connection to the websocket */
    public function close();

    /** Read data from the socket */
    public function read();

    /** Sends data through the websocket */
    public function send();

    /** Keeps alive the connection */
    public function keepAlive();
}

Add some constants for all the engines

Add some constants for all the engines


<?php

namespace OpenDominion\Providers;

use Cache;
use Illuminate\Contracts\View\View;
use Illuminate\Support\ServiceProvider;
use OpenDominion\Calculators\NetworthCalculator;
use OpenDominion\Services\DominionSelectorService;

class ComposerServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function boot()
    {
        view()->composer('partials.main-footer', function (View $view) {
            $version = (Cache::has('version') ? Cache::get('version') : 'unknown');
            $view->with('version', $version);
        });

        view()->composer('partials.resources-overview', function (View $view) {
            $networthCalculator = app(NetworthCalculator::class);
            $networthCalculator->initDependencies();
            $view->with('networthCalculator', $networthCalculator);
        });
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

<?php

namespace OpenDominion\Providers;

use Cache;
use Illuminate\Contracts\View\View;
use Illuminate\Support\ServiceProvider;
use OpenDominion\Calculators\NetworthCalculator;

class ComposerServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function boot()
    {
        view()->composer('partials.main-footer', function (View $view) {
            $version = (Cache::has('version') ? Cache::get('version') : 'unknown');
            $view->with('version', $version);
        });

        // todo: do we need this here in this class?
        view()->composer('partials.resources-overview', function (View $view) {
            $networthCalculator = app(NetworthCalculator::class);
            $view->with('networthCalculator', $networthCalculator);
        });
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

Remove initDependencies from composer service provider


<?php

namespace Edujugon\Skeleton\Providers;

use Edujugon\Skeleton\Skeleton;
use Illuminate\Support\ServiceProvider;

class SkeletonServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $config_path = function_exists('config_path') ? config_path('skeleton.php') : 'skeleton.php';

        $this->publishes([
            __DIR__.'/../Config/config.php' => $config_path,
        ], 'config');
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app['skeleton'] = $this->app->share(function($app)
        {
            return new Skeleton;
        });
    }
}

<?php

namespace Edujugon\Skeleton\Providers;

use Edujugon\Skeleton\Skeleton;
use Illuminate\Support\ServiceProvider;

class SkeletonServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $config_path = function_exists('config_path') ? config_path('skeleton.php') : 'skeleton.php';

        $this->publishes([
            __DIR__.'/../Config/config.php' => $config_path,
        ], 'config');
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('skeleton', function ($app) {
            return new Skeleton();
        });
    }
}

Update ServiceProvider to singleton registration


<?php

namespace Ordermind\LogicalPermissions;

interface AccessCheckerInterface {
  /**
   * Sets the permission type collection.
   *
   * @param \Ordermind\LogicalPermissions\PermissionTypeCollectionInterface $permissionTypeCollection
   *
   * @return \Ordermind\LogicalPermissions\AccessCheckerInterface
   */
  public function setPermissionTypeCollection(\Ordermind\LogicalPermissions\PermissionTypeCollectionInterface $permissionTypeCollection);

  /**
   * Gets the permission type collection.
   *
   * @return \Ordermind\LogicalPermissions\PermissionTypeCollectionInterface|NULL
   */
  public function getPermissionTypeCollection();

  /**
   * Sets the bypass access checker.
   *
   * @param \Ordermind\LogicalPermissions\BypassAccessCheckerInterface $bypassAccessChecker
   *
   * @return \Ordermind\LogicalPermissions\AccessCheckerInterface
   */
  public function setBypassAccessChecker(BypassAccessCheckerInterface $bypassAccessChecker);

  /**
   * Gets the bypass access checker.
   *
   * @return \Ordermind\LogicalPermissions\BypassAccessCheckerInterface|NULL
   */
  public function getBypassAccessChecker();

  /**
   * Gets all keys that can be used in a permission tree.
   *
   * @return array Valid permission keys.
   */
  public function getValidPermissionKeys();

  /**
  * Checks access for a permission tree.
  * @param array|string|bool $permissions The permission tree to be evaluated.
  * @param array|object|NULL $context (optional) A context that could for example contain the evaluated user and document. Default value is NULL.
  * @param bool $allowBypass (optional) Determines whether bypassing access should be allowed. Default value is TRUE.
  * @return bool TRUE if access is granted or FALSE if access is denied.
  */
  public function checkAccess($permissions, $context = NULL, $allowBypass = TRUE);

}

<?php

namespace Ordermind\LogicalPermissions;

interface AccessCheckerInterface
{
    /**
     * Sets the permission type collection.
     *
     * @param PermissionTypeCollectionInterface $permissionTypeCollection
     *
     * @return AccessCheckerInterface
     */
    public function setPermissionTypeCollection(PermissionTypeCollectionInterface $permissionTypeCollection);

    /**
     * Gets the permission type collection.
     *
     * @return PermissionTypeCollectionInterface|null
     */
    public function getPermissionTypeCollection();

    /**
     * Sets the bypass access checker.
     *
     * @param BypassAccessCheckerInterface $bypassAccessChecker
     *
     * @return AccessCheckerInterface
     */
    public function setBypassAccessChecker(BypassAccessCheckerInterface $bypassAccessChecker);

    /**
     * Gets the bypass access checker.
     *
     * @return BypassAccessCheckerInterface|null
     */
    public function getBypassAccessChecker();

    /**
     * Gets all keys that can be used in a permission tree.
     *
     * @return array Valid permission keys.
     */
    public function getValidPermissionKeys();

    /**
     * Checks access for a permission tree.
     * @param array|string|bool $permissions The permission tree to be evaluated.
     * @param array|object|null $context (optional) A context that could for example contain the evaluated user and document. Default value is NULL.
     * @param bool              $allowBypass (optional) Determines whether bypassing access should be allowed. Default value is TRUE.
     *
     * @return bool TRUE if access is granted or FALSE if access is denied.
     */
    public function checkAccess($permissions, $context = null, $allowBypass = true);
}

Clean up access checker interface

Clean up access checker interface


<?php

namespace drunomics\Phapp\Commands;

use drunomics\Phapp\PhappCommandBase;
use drunomics\Phapp\ServiceUtil\BuildCommandsTrait;

/**
 * Provides the install command.
 */
class InstallCommands extends PhappCommandBase  {

  use BuildCommandsTrait;

  /**
   * Installs the application.
   *
   * @option bool $build Build before running an update if the app is in
   *   development mode.
   *
   * @command install
   */
  public function install(array $options = ['build' => TRUE]) {
    $collection = $this->collectionBuilder();
    $collection->setProgressIndicator(NULL);
    if (getenv('PHAPP_ENV_MODE') == 'development' && $options['build']) {
      $collection->addCode(function() {
        $this->io()->title('Building...');
      });
      $collection->addTask(
        $this->getBuildCommands()->build(['clean' => FALSE])
      );
      $collection->addCode(function() {
        $this->io()->title('Installing...');
      });
    }
    $collection->addTask(
      $this->invokeManifestCommand('install')
    );
    return $collection;
  }

}

<?php

namespace drunomics\Phapp\Commands;

use drunomics\Phapp\PhappCommandBase;
use drunomics\Phapp\ServiceUtil\BuildCommandsTrait;

/**
 * Provides the install command.
 */
class InstallCommands extends PhappCommandBase  {

  use BuildCommandsTrait;

  /**
   * Installs the application.
   *
   * @option bool $build Build before running an update.
   *
   * @command install
   */
  public function install(array $options = ['build' => TRUE]) {
    $collection = $this->collectionBuilder();
    $collection->setProgressIndicator(NULL);
    if ($options['build']) {
      $collection->addCode(function() {
        $this->io()->title('Building...');
      });
      $collection->addTask(
        $this->getBuildCommands()->build(['clean' => FALSE])
      );
      $collection->addCode(function() {
        $this->io()->title('Installing...');
      });
    }
    $collection->addTask(
      $this->invokeManifestCommand('install')
    );
    return $collection;
  }

}

Remove broken development mode detection from install command, but build by default as init does.


<?php

namespace LaravelFlare\Cms;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class CmsServiceProvider extends ServiceProvider
{
    /**
     * Perform post-registration booting of services.
     */
    public function boot(Router $router)
    {
        $router->middleware('checkslugexists', 'LaravelFlare\Cms\Http\Middleware\CheckSlugExists');

        $this->publishes([
            __DIR__.'/Database/Migrations' => base_path('database/migrations'),
        ]);

        // Routes
        if (!$this->app->routesAreCached()) {
            require __DIR__.'/Http/routes.php';
        }

        // Views
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'flare');
        $this->publishes([
            __DIR__.'/../resources/views' => base_path('resources/views/vendor/flare'),
        ]);
    }

    /**
     * Register any package services.
     */
    public function register()
    {
    }

    /**
     * Register Service Providers.
     */
    protected function registerServiceProviders()
    {
    }

    /**
     * Register Blade Operators.
     */
    protected function registerBladeOperators()
    {
    }
}

<?php

namespace LaravelFlare\Cms;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class CmsServiceProvider extends ServiceProvider
{
    /**
     * Perform post-registration booting of services.
     */
    public function boot(Router $router)
    {
        $router->middleware('checkslugexists', 'LaravelFlare\Cms\Http\Middleware\CheckSlugExists');

        $this->publishes([
            __DIR__.'/Database/Migrations' => base_path('database/migrations'),
        ]);

        // Views
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'flare');
        $this->publishes([
            __DIR__.'/../resources/views' => base_path('resources/views/vendor/flare'),
        ]);
    }

    /**
     * Register any package services.
     */
    public function register()
    {
        // Routes
        if (!$this->app->routesAreCached()) {
            require __DIR__.'/Http/routes.php';
        }
    }

    /**
     * Register Service Providers.
     */
    protected function registerServiceProviders()
    {
    }

    /**
     * Register Blade Operators.
     */
    protected function registerBladeOperators()
    {
    }
}

Fix CMS Service Provider Routes

Fix CMS Service Provider Routes


<?php
namespace Haystack\Functional;

use Haystack\Container\ContainerInterface;
use Haystack\HArray;
use Haystack\Helpers\Helper;
use Haystack\HString;

class HaystackMap
{
    /** @var array */
    private $arr;

    /**
     * @param HArray $array
     */
    public function __construct(HArray $array)
    {
        $this->arr = $array->toArray();
    }

    /**
     * @param callable $func
     * @param array $variadicList Variadic list of arrays to invoke array_map with
     * @return array
     */
    public function map(callable $func, array $variadicList = [])
    {
        $sourceHaystack = [$this->arr];

        $arrayOfVariadics = array_map(function ($item) {
            return $this->convertToArray($item);
        }, $variadicList);

        return call_user_func_array('array_map', array_merge([$func], $sourceHaystack, $arrayOfVariadics));
    }

    private function convertToArray($item)
    {
        if (is_string($item)) {
            return (new HString($item))->toArray();
        }

        if ($item instanceof ContainerInterface) {
            return $item->toArray();
        }

        if (is_array($item)) {
            return $item;
        }

        throw new \InvalidArgumentException(Helper::getType($item) . " cannot be mapped");
    }
}

<?php
namespace Haystack\Functional;

use Haystack\Container\ContainerInterface;
use Haystack\HArray;
use Haystack\Helpers\Helper;
use Haystack\HString;

class HaystackMap
{
    /** @var array */
    private $arr;

    /**
     * @param HArray $array
     */
    public function __construct(HArray $array)
    {
        $this->arr = $array->toArray();
    }

    /**
     * @param callable $func
     * @param array $variadicList Variadic list of arrays to invoke array_map with
     * @return array
     */
    public function map(callable $func, array $variadicList = [])
    {
        $sourceHaystack = [$this->arr];

        $arrayOfVariadics = array_map(function ($item) {
            return $this->convertToArray($item);
        }, $variadicList);

        return call_user_func_array('array_map', array_merge([$func], $sourceHaystack, $arrayOfVariadics));
    }

    private function convertToArray($item)
    {
        if (is_array($item)) {
            return $item;
        }

        if (is_string($item)) {
            return (new HString($item))->toArray();
        }

        if ($item instanceof ContainerInterface) {
            return $item->toArray();
        }

        throw new \InvalidArgumentException(Helper::getType($item) . " cannot be mapped");
    }
}

Return from exit condition sooner

Return from exit condition sooner

Since an array doesn't need to be converted to itself, there's
no reason to go any further in this method.


<?php

namespace rkgrep\Locales;

use Illuminate\Support\ServiceProvider;

class LocalesServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        // merge default config
        $this->mergeConfigFrom(
            __DIR__.'/../config/locales.php',
            'locales'
        );

        $this->app->singleton('locales', function($app) {
            return new LocaleManager($app);
        });

        $this->app->singleton('locales.driver', function ($app) {
            return $app['locales']->driver();
        });

        $this->app->bind(Contracts\Locale::class, function ($app) {
            return $app['locales']->locale();
        });

        // Register a separate console commands provider as deferred
        $this->app->registerDeferredProvider(ConsoleServiceProvider::class);
    }

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes(array(
            __DIR__.'/../config/locales.php' => config_path('locales.php')
        ));
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return [
            'locales',
            'locales.driver',
            'rkgrep\Locales\Contracts\Locale',
        ];
    }
}

<?php

namespace rkgrep\Locales;

use Illuminate\Support\ServiceProvider;

class LocalesServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        // merge default config
        $this->mergeConfigFrom(
            __DIR__.'/../config/locales.php',
            'locales'
        );

        $this->app->singleton('locales', function($app) {
            return new LocaleManager($app);
        });

        $this->app->singleton('locales.driver', function ($app) {
            return $app['locales']->driver();
        });

        $this->app->bind(Contracts\Locale::class, function ($app) {
            return $app['locales']->active();
        });

        // Register a separate console commands provider as deferred
        $this->app->registerDeferredProvider(ConsoleServiceProvider::class);
    }

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes(array(
            __DIR__.'/../config/locales.php' => config_path('locales.php')
        ));
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return [
            'locales',
            'locales.driver',
            'rkgrep\Locales\Contracts\Locale',
        ];
    }
}

Fix active locale method call

Fix active locale method call


<!doctype html>

      <title>Kathy's Garden Planner</title>
      <link rel="stylesheet" href="style.css">

      <meta charset="utf-8">
      <meta name="google-signin-client_id" content="<?php echo $googleClientId; ?>">
      <meta name="viewport" content="width=device-width, initial-scale=1">

Remove CDN for fetch and bump version for es6-shim

The fetch API is now pulled in by isomorphic-fetch.


has($options['validateName']) ? 'has-error' : '' }}">
    {!! Form::label($elementName, $options['label']) !!}
    {!! Form::select($elementName, $record->{$options['select_options']}(), $record->{$options['relationMethod']}->pluck($options['selectedKey'])->all(), [
            'class' => 'form-control select2 '.array_get($options, "additionalClass"),
            'multiple' => 'multiple',
        ]) !!}

        {{ join($errors->get($options['validateName']), '
') }}

has($options['validateName']) ? 'has-error' : '' }}">
    {!! Form::label($elementName, $options['label']) !!}
    {!! Form::select($elementName, $sourceModel->toOptionsArray(), $record->{$options['relationMethod']}->pluck($options['selectedKey'])->all(), [
            'class' => 'form-control select2 '.array_get($options, "additionalClass"),
            'multiple' => 'multiple',
        ]) !!}

        {{ join($errors->get($options['validateName']), '
') }}

Add source model also for many to many

Add source model also for many to many


<?php

namespace Websanova\EasyCache;

class EasyCacheCollection extends \Illuminate\Database\Eloquent\Collection
{
    public function recount($field)
    {
        foreach ($this->items as $item) {
            $item->recount($field);
        }

        return $this;
    }

    public function reset()
    {
        foreach ($this->items as $item) {
            $item->reset();
        }

        return $this;
    }

    public function flush()
    {
        foreach ($this->items as $item) {
            $item->flush();
        }

        return $this;
    }
}

<?php

namespace Websanova\EasyCache;

class EasyCacheCollection extends \Illuminate\Database\Eloquent\Collection
{
    public function recount($field, $relation = null)
    {
        foreach ($this->items as $item) {
            $item->recount($field, $relation);
        }

        return $this;
    }

    public function reset()
    {
        foreach ($this->items as $item) {
            $item->reset();
        }

        return $this;
    }

    public function flush()
    {
        foreach ($this->items as $item) {
            $item->flush();
        }

        return $this;
    }
}

Fix recount relations when using collection.


<?php declare(strict_types=1);

namespace Becklyn\RadBundle\Entity\Interfaces;

interface SortableEntityInterface extends EntityInterface
{
    /**
     * Returns the sort order
     *
     * @return int
     */
    public function getSortOrder () : int;

    /**
     * Sets the sort order
     *
     * @param int $sortOrder
     */
    public function setSortOrder (int $sortOrder) : void;
}

<?php declare(strict_types=1);

namespace Becklyn\RadBundle\Entity\Interfaces;

interface SortableEntityInterface extends EntityInterface
{
    /**
     * Returns the sort order
     *
     * @return int
     */
    public function getSortOrder () : ?int;

    /**
     * Sets the sort order
     *
     * @param int $sortOrder
     */
    public function setSortOrder (int $sortOrder) : void;
}

Allow null in getSortOrder in interface

Allow null in getSortOrder in interface


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    protected $table = 'posts';
}

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    protected $table = 'posts';

    /**
     * Get the thread containing the post
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function thread()
    {
        return $this->belongsTo('App\Thread');
    }
}

Add reverse relationship to parent thread inside post model


<?php
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);?>

<?php $this->beginPage() ?>

<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">

		<meta charset="utf-8" />
	    <meta name="viewport" content="width=device-width, initial-scale=1">
		<?= Html::csrfMetaTags() ?>
		<link rel="stylesheet" type="text/css" href="../css/main_site.css" />
		<link rel="shortcut icon" href="../images/favicon.ico" />
		<title><?= Html::encode($this->title) ?></title>
	    <?php $this->head() ?>

		<?php $this->beginBody() ?>

				<?= $content ?>

Copyright by Khnure Students. 2014

		<?php $this->endBody() ?>

<?php $this->endPage() ?>

Fix oops in previous commit(folder shadow).


<?php

namespace drunomics\Phapp;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Robo\Tasks;

/**
 * Base class for phapp command classes.
 */
abstract class PhappCommandBase extends Tasks implements LoggerAwareInterface {

  use LoggerAwareTrait;

  /**
   * Whether the command requires a valid phapp manifest.
   *
   * @var bool
   */
  protected $requiresPhappManifest = TRUE;

  /**
   * The maniftest of the current phapp instance.
   *
   * @var \drunomics\Phapp\PhappManifest|null
   */
  protected $phappManifest;

  /**
   * The global phapp config.
   *
   * @var \drunomics\Phapp\GlobalConfig
   */
  protected $globalConfig;

  /**
   * Ensures with a valid phapp definition to interact with.
   *
   * @hook validate
   */
  public function init() {
    $this->globalConfig = GlobalConfig::discoverConfig();
    if ($this->requiresPhappManifest) {
      $this->phappManifest = PhappManifest::getInstance();
      $this->initShellEnvironment();
    }
    $this->stopOnFail(TRUE);
  }

  /**
   * Switches the working directory and adds the composer bin-dir to the path.
   *
   * @return $this
   */
  protected function initShellEnvironment() {
    chdir($this->phappManifest->getConfigFile()->getPath());
    $path = getenv("PATH");
    putenv("PATH=../vendor/bin/:../bin:$path");
    return $this;
  }

}

<?php

namespace drunomics\Phapp;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Robo\Tasks;

/**
 * Base class for phapp command classes.
 */
abstract class PhappCommandBase extends Tasks implements LoggerAwareInterface {

  use LoggerAwareTrait;

  /**
   * Whether the command requires a valid phapp manifest.
   *
   * @var bool
   */
  protected $requiresPhappManifest = TRUE;

  /**
   * The maniftest of the current phapp instance.
   *
   * @var \drunomics\Phapp\PhappManifest|null
   */
  protected $phappManifest;

  /**
   * The global phapp config.
   *
   * @var \drunomics\Phapp\GlobalConfig
   */
  protected $globalConfig;

  /**
   * Ensures with a valid phapp definition to interact with.
   *
   * @hook validate
   */
  public function init() {
    $this->globalConfig = GlobalConfig::discoverConfig();
    if ($this->requiresPhappManifest) {
      $this->phappManifest = PhappManifest::getInstance();
      $this->initShellEnvironment();
    }
    $this->stopOnFail(TRUE);
  }

  /**
   * Switches the working directory and adds the composer bin-dir to the path.
   *
   * @return $this
   */
  protected function initShellEnvironment() {
    chdir($this->phappManifest->getFile()->getPath());
    $path = getenv("PATH");
    putenv("PATH=../vendor/bin/:../bin:$path");
    return $this;
  }

}

Fix critical issue when running phapp commands.


<?php

namespace Leezy\PheanstalkBundle\Tests;

use Leezy\PheanstalkBundle\ConnectionLocator;

class ConnectionLocatorTest extends \PHPUnit_Framework_TestCase {
    public function testDefaultConnections()
    {
        $connectionLocator = new ConnectionLocator();

        $this->assertNotNull($connectionLocator->getConnections());
    }

    public function testGetDefaultConnection()
    {
        $connection = new \Pheanstalk_Pheanstalk('localhost', '11300');

        $connectionLocator = new ConnectionLocator();
        $connectionLocator->addConnection('default', $connection);

        $this->assertEquals($connection, $connectionLocator->getConnection('default'));
    }

    public function testGetNoDefinedConnection()
    {
        $connection = new \Pheanstalk_Pheanstalk('localhost', '11300');

        $connectionLocator = new ConnectionLocator();
        $connectionLocator->addConnection('default', $connection);

        $this->assertNull($connectionLocator->getConnection('john.doe'));
    }
}

<?php

namespace Leezy\PheanstalkBundle\Tests;

use Leezy\PheanstalkBundle\ConnectionLocator;

class ConnectionLocatorTest extends \PHPUnit_Framework_TestCase {
    public function testDefaultConnections()
    {
        $connectionLocator = new ConnectionLocator();

        $this->assertNotNull($connectionLocator->getConnections());
    }

    public function testGetDefaultConnection()
    {
        $connection = new \Pheanstalk_Pheanstalk('localhost', '11300');

        $connectionLocator = new ConnectionLocator();
        $connectionLocator->addConnection('default', $connection);

        $this->assertEquals($connection, $connectionLocator->getConnection(null));
    }

    public function testGetNoDefinedConnection()
    {
        $connection = new \Pheanstalk_Pheanstalk('localhost', '11300');

        $connectionLocator = new ConnectionLocator();
        $connectionLocator->addConnection('default', $connection);

        $this->assertNull($connectionLocator->getConnection('john.doe'));
    }
}

Update the test connection value

Update the test connection value


<?php

require_once(__DIR__ . '/../test_helpers.php');

class Recource_Mock_Resource extends Recurly_Resource {
  protected function getNodeName() {
    return 'mock';
  }
  protected function getWriteableAttributes() {
    return array('date', 'bool', 'number', 'array', 'nil', 'string');
  }
  protected function getRequiredAttributes() {
    return array('required');
  }
}

class Recurly_ResourceTest extends Recurly_TestCase {

  public function testXml() {
    $resource = new Recource_Mock_Resource();
    $resource->date = new DateTime("@1384202874");
    $resource->bool = true;
    $resource->number = 34;
    $resource->array = array(
      'int' => 1,
      'string' => 'foo',
    );
    $resource->nil = null;
    $resource->string = "Foo & Bar";
    $this->assertEquals(
      "<?xml version=\"1.0\"?>\n<mock><date>2013-11-11T20:47:54+00:00</date><bool>true</bool><number>34</number><array><int>1</int><string>foo</string></array><nil nil=\"nil\"></nil><string>Foo & Bar</string></mock>\n",
      $resource->xml()
    );
  }
}

<?php

require_once(__DIR__ . '/../test_helpers.php');

class Mock_Resource extends Recurly_Resource {
  protected function getNodeName() {
    return 'mock';
  }
  protected function getWriteableAttributes() {
    return array('date', 'bool', 'number', 'array', 'nil', 'string');
  }
  protected function getRequiredAttributes() {
    return array('required');
  }
}

class Recurly_ResourceTest extends Recurly_TestCase {

  public function testXml() {
    $resource = new Mock_Resource();
    $resource->date = new DateTime("@1384202874");
    $resource->bool = true;
    $resource->number = 34;
    $resource->array = array(
      'int' => 1,
      'string' => 'foo',
    );
    $resource->nil = null;
    $resource->string = "Foo & Bar";
    $this->assertEquals(
      "<?xml version=\"1.0\"?>\n<mock><date>2013-11-11T20:47:54+00:00</date><bool>true</bool><number>34</number><array><int>1</int><string>foo</string></array><nil nil=\"nil\"></nil><string>Foo & Bar</string></mock>\n",
      $resource->xml()
    );
  }
}

Fix the spelling of the class name

Fix the spelling of the class name


<?php

namespace NotificationChannels\Authy;

class AuthyMessage
{
    /**
     * Determine whether to force the notification over cellphone network.
     *
     * @var bool
     */
    public $force = false;

    /**
     * The notification method (sms/call).
     *
     * @var string
     */
    public $method = 'sms';

    /**
     * Create a new Authy message instance.
     *
     * @return static
     */
    public static function create()
    {
        return new static();
    }

    /**
     * Indicate that the notification is forced over cellphone network.
     *
     * @return $this
     */
    public function force()
    {
        $this->force = true;

        return $this;
    }

    /**
     * Set the method of the Authy message.
     *
     * @param string $method
     *
     * @return $this
     */
    public function method($method)
    {
        $this->method = $method === 'call' ? 'call' : 'sms';

        return $this;
    }
}

<?php

namespace NotificationChannels\Authy;

class AuthyMessage
{
    /**
     * The notification method (sms/call).
     *
     * @var string
     */
    public $method = 'sms';

    /**
     * Determine whether to force the notification over cellphone network.
     *
     * @var bool
     */
    public $force = false;

    /**
     * Create a new Authy message instance.
     *
     * @return static
     */
    public static function create()
    {
        return new static();
    }

    /**
     * Set the method of the Authy message.
     *
     * @param string $method
     *
     * @return $this
     */
    public function method($method)
    {
        $this->method = $method === 'call' ? 'call' : 'sms';

        return $this;
    }

    /**
     * Indicate that the notification is forced over cellphone network.
     *
     * @return $this
     */
    public function force()
    {
        $this->force = true;

        return $this;
    }
}

Enforce consistency, arrange code around


<?php
return [

	/**
	 * The storage config
	 */
	"storage" => [
		/**
		 * Returns the folder name of the chunks. The location is in storage/app/{folder_name}
		 */
		"chunks" => "chunks",
		"disk" => "local"
	],
	"clear" => [
		/**
		 * How old chunks we should delete
		 */
		"timestamp" => "-3 HOURS",
		"schedule" => [
			"enabled" => true,
			"cron" => "0 */1 * * * *" // run every hour
		]
	],
	"chunk" => [
		// setup for the chunk naming setup to ensure same name upload at same time
		"name" => [
			"use" => [
				"session" => true, // should the chunk name use the session id? The uploader muset send cookie!,
				"browser" => false // instead of session we can use the ip and browser?
			]
		]
	]
];

<?php
return [

	/**
	 * The storage config
	 */
	"storage" => [
		/**
		 * Returns the folder name of the chunks. The location is in storage/app/{folder_name}
		 */
		"chunks" => "chunks",
		"disk" => "local"
	],
	"clear" => [
		/**
		 * How old chunks we should delete
		 */
		"timestamp" => "-3 HOURS",
		"schedule" => [
			"enabled" => true,
			"cron" => "0 */1 * * * *" // run every hour
		]
	],
	"chunk" => [
		// setup for the chunk naming setup to ensure same name upload at same time
		"name" => [
			"use" => [
				"session" => false, // should the chunk name use the session id? The uploader muset send cookie!,
				"browser" => true // instead of session we can use the ip and browser?
			]
		]
	]
];

Fix missing part upload just change config because session id always change for every request


<?php
/**
 * Minify CSS Preprocessor class file
 *
 * @package Holograph
 */

namespace Holograph\Preprocessor\Css;

use Holograph\Preprocessor\PreprocessorAbstract;
use Holograph\FileOps;

/**
 * Class to minify and combine Css files
 *
 * @package Holograph
 * @author Jansen Price <jansen.price@gmail.com>
 * @version $Id$
 */
class Minify extends PreprocessorAbstract
{
    /**
     * Execute preprocessor
     *
     * This will take all CSS files from the source dir, minify each one and
     * then combine them into one file.
     *
     * @param array $options Options for execution
     * @return void
     */
    public function execute($options = array())
    {
        $cssFiles = FileOps::rglob("*.css", 0, $this->getSourceDir());

        if (empty($cssFiles)) {
            return false;
        }

        FileOps::ensurePathExists($this->getDestinationDir());

        $mainStylesheet = $options['main_stylesheet'];

        $buffer = array();
        foreach ($cssFiles as $file) {
            $content = file_get_contents($file);

            $newContent = \Minify_CSS_Compressor::process($content);

            $newfile = str_replace(
                $this->getSourceDir(),
                $this->getDestinationDir(),
                $file
            );

            $buffer[] = $newContent;
        }

        if ($buffer) {
            file_put_contents($mainStylesheet, implode("\n", $buffer));
        }
    }
}

<?php
/**
 * Minify CSS Preprocessor class file
 *
 * @package Holograph
 */

namespace Holograph\Preprocessor\Css;

use Holograph\Preprocessor\PreprocessorAbstract;
use Holograph\FileOps;

/**
 * Class to minify and combine Css files
 *
 * @package Holograph
 * @author Jansen Price <jansen.price@gmail.com>
 * @version $Id$
 */
class Minify extends PreprocessorAbstract
{
    /**
     * Execute preprocessor
     *
     * This will take all CSS files from the source dir, minify each one and
     * then combine them into one file.
     *
     * @param array $options Options for execution
     * @return void
     */
    public function execute($options = array())
    {
        $cssFiles = FileOps::rglob("*.css", 0, $this->getSourceDir());

        if (empty($cssFiles)) {
            return false;
        }

        FileOps::ensurePathExists($this->getDestinationDir());

        // Just get the basename of the main style sheet, this will be written
        // to the destination dir
        $mainStylesheet = basename($options['main_stylesheet']);
        $mainStylesheet = $this->getDestinationDir() . DIRECTORY_SEPARATOR . $mainStylesheet;

        $buffer = array();
        foreach ($cssFiles as $file) {
            $content = file_get_contents($file);

            $newContent = \Minify_CSS_Compressor::process($content);

            $buffer[] = $newContent;
        }

        if ($buffer) {
            file_put_contents($mainStylesheet, implode("\n", $buffer));
        }
    }
}

Update minifier to write to build file more smartly

This handles cases where the main stylesheet is referenced from a
subdir or different directory from the root of index.html, but
still allow the minifier to write to the file using a different path
(for example outside of the webroot).


<?php

require "WhatsNew.inc";

// dynamic pages need to include dynamics scripts
switch($_REQUEST['page']) {

  // dynamic cases
  case "statistics":
    require "statistics.php";
    break;

  // static cases
  case "background":
    $device_phrases = array(
      "Webkit" => "iPhone, Android, and Palm webOS phones",
      "Touch" => "touchscreen phones",
      "Basic" => "non-touchscreen phones"
    );
    $device_phrase = $device_phrases[$page->branch];

  case "requirements":
  case "credits":
    require "$page->branch/{$_REQUEST['page']}.html";
    $page->cache();
    $page->output();
    break;

  case "about":
  default:
    $whats_new = new WhatsNew();
    $whats_new_count = $whats_new->count(WhatsNew::getLastTime());
    require "$page->branch/index.html";
    $page->output();
}

?>

<?php

require "WhatsNew.inc";

// dynamic pages need to include dynamics scripts
$pageParam = isset($_REQUEST['page']) ? $_REQUEST['page'] : 'about';

switch($pageParam) {

  // dynamic cases
  case "statistics":
    require "statistics.php";
    break;

  // static cases
  case "background":
    $device_phrases = array(
      "Webkit" => "iPhone, Android, and Palm webOS phones",
      "Touch" => "touchscreen phones",
      "Basic" => "non-touchscreen phones"
    );
    $device_phrase = $device_phrases[$page->branch];

  case "requirements":
  case "credits":
    require "$page->branch/{$_REQUEST['page']}.html";
    $page->cache();
    $page->output();
    break;

  case "about":
  default:
    $whats_new = new WhatsNew();
    $whats_new_count = $whats_new->count(WhatsNew::getLastTime());
    require "$page->branch/index.html";
    $page->output();
}

?>

Handle case where page parameter is not set.


<?php
/**
 * Created by PhpStorm.
 * User: gpl
 * Date: 15/10/27
 * Time: 下午2:55
 */

namespace Dy\Ring\Rule;

use Dy\Ring\Exception\InvalidArgumentException;
use Dy\Ring\Exception\OutOfBoundsException;
use Dy\Ring\Source\AbstractSource;

final class SizeRule extends AbstractRule
{
    /**
     * @var int
     */
    protected $maxSize = 0;

    public function __construct($maxSize)
    {
        if (intval($maxSize) === 0) {
            throw new InvalidArgumentException('maxSize can\'t be' . $maxSize);
        }
        $this->maxSize = intval($maxSize);
    }

    /**
     * @param AbstractSource $source
     * @return bool
     */
    public function check(AbstractSource $source)
    {
        // TODO: Implement check() method.
        if ($this->maxSize === 0) {
            throw new InvalidArgumentException('maxSize cant\'t be 0');
        }
        if ($this->maxSize < $source->getFileSize()) {
            throw new OutOfBoundsException('File size ' . $source->getFileSize() . ' exceeded maxSize ' . $this->maxSize);
        }
        return true;
    }
}

Fix line size too long

Fix line size too long


<?php

/*
 * This file is part of EmailChecker.
 *
 * (c) Corrado Ronci <sorciulus@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace sorciulus\EmailChecker\Tests;

use PHPUnit\Framework\TestCase;
use GuzzleHttp\Client;
use sorciulus\EmailChecker\DisponsableChecker;
use sorciulus\EmailChecker\Exception\DisponsableException;

class DisponsableCheckerTest extends TestCase
{

    public function testDisponsableCheckerInstanceTrue()
    {
        $instance = new DisponsableChecker();

        $this->assertInstanceOf(DisponsableChecker::class, $instance);
    }

    public function testIsEnableIsBooleanTrue()
    {
        $instance = new DisponsableChecker();
        $this->assertInternalType("boolean", $instance->isEnable());

    }

    public function testApiCall()
    {
        $client = new Client("https://open.kickbox.io", array(
            'request.options' => array(
                'exceptions' => false,
            )
        ));

        $response = $client->get("/v1/disposable/gmail.com");
        $body = (string)$response->getBody();
        $data = json_decode($body, true);
        $this->assertInternalType("string", $body);
        $this->assertInternalType("array", $data);
        $this->assertArrayHasKey("disposable", $data);
        $this->assertInternalType("boolean", $data["disposable"]);
    }
}

<?php

/*
 * This file is part of EmailChecker.
 *
 * (c) Corrado Ronci <sorciulus@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace sorciulus\EmailChecker\Tests;

use PHPUnit\Framework\TestCase;
use GuzzleHttp\Client;
use sorciulus\EmailChecker\DisponsableChecker;
use sorciulus\EmailChecker\Exception\DisponsableException;

class DisponsableCheckerTest extends TestCase
{

    public function testDisponsableCheckerInstanceTrue()
    {
        $instance = new DisponsableChecker();

        $this->assertInstanceOf(DisponsableChecker::class, $instance);
    }

    public function testIsEnableIsBooleanTrue()
    {
        $instance = new DisponsableChecker();
        $this->assertInternalType("boolean", $instance->isEnable());

    }

    public function testApiCall()
    {
        $client = new Client([
            "base_uri" => "https://open.kickbox.io"
        ]);

        $response = $client->get("/v1/disposable/gmail.com");
        $body = (string)$response->getBody();
        $data = json_decode($body, true);
        $this->assertInternalType("string", $body);
        $this->assertInternalType("array", $data);
        $this->assertArrayHasKey("disposable", $data);
        $this->assertInternalType("boolean", $data["disposable"]);
    }
}

Fix Guzzle client in DisponsableCheck Test


<?php

namespace RIPS\Connector\Requests;

class UserRequests extends BaseRequest
{
    // @var string
    protected $uri = '/users';

    /**
     * Get all users
     *
     * @param array $queryParams
     * @return array
     */
    public function getAll(array $queryParams)
    {
        $response = $this->client->get($this->uri, [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }

    /**
     * Get a user by user ID
     *
     * @param int $userId
     * @return array
     */
    public function getById(int $userId)
    {
        $response = $this->client->get("{$this->uri}/{$userId}");

        return $this->handleResponse($response);
    }

    /**
     * Invite a new user
     *
     * @param array $input
     * @return array
     */
    public function invite(array $input)
    {
        $response = $this->client->post("{$this->uri}/invite/ui", [
            'form_params' => ['user' => $input],
        ]);

        return $this->handleResponse($response);
    }
}

<?php

namespace RIPS\Connector\Requests;

class UserRequests extends BaseRequest
{
    // @var string
    protected $uri = '/users';

    /**
     * Get all users
     *
     * @param array $queryParams
     * @return array
     */
    public function getAll(array $queryParams = [])
    {
        $response = $this->client->get($this->uri, [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }

    /**
     * Get a user by user ID
     *
     * @param int $userId
     * @return array
     */
    public function getById(int $userId)
    {
        $response = $this->client->get("{$this->uri}/{$userId}");

        return $this->handleResponse($response);
    }

    /**
     * Invite a new user
     *
     * @param array $input
     * @return array
     */
    public function invite(array $input)
    {
        $response = $this->client->post("{$this->uri}/invite/ui", [
            'form_params' => ['user' => $input],
        ]);

        return $this->handleResponse($response);
    }
}

Set default value for query params

Set default value for query params


<?php

namespace MaxBucknell\Gulp\Console\Command;

use MaxBucknell\Gulp\Model\Filesystem;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Install extends Command
{
    /**
     * @var Filesystem
     */
    private $filesystem;

    public function __construct(
        Filesystem $filesystem,
        $name = null
    ) {
        parent::__construct($name);

        $this->filesystem = $filesystem;
    }

    protected function configure()
    {
        $this->setName('setup:gulp:install');
        $this->setDescription('Install all NPM dependencies');
        $this->addOption(
            'npm',
            null,
            InputOption::VALUE_NONE,
            'Whether to use npm instead of yarn'
        );
    }

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

        $executable = $input->getOption('npm') ? 'npm' : 'yarn';
        $directory = $this->filesystem->getAbsoluteLocation();

        chdir($directory);
        passthru("$executable install");
    }
}

<?php

namespace MaxBucknell\Gulp\Console\Command;

use MaxBucknell\Gulp\Model\Filesystem;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Install extends Command
{
    /**
     * @var Filesystem
     */
    private $filesystem;

    public function __construct(
        Filesystem $filesystem,
        $name = null
    ) {
        parent::__construct($name);

        $this->filesystem = $filesystem;
    }

    protected function configure()
    {
        $this->setName('setup:gulp:install');
        $this->setDescription('Install all NPM dependencies');
        $this->addOption(
            'npm',
            null,
            InputOption::VALUE_NONE,
            'Whether to use npm instead of yarn'
        );
    }

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

        $executable = $input->getOption('npm') ? 'npm' : 'yarn';
        $directory = $this->filesystem->getAbsoluteLocation();

        chdir($directory);
        passthru("rm -rf package-lock.json");
        passthru("$executable install");
    }
}

Remove lock file before installing

Remove lock file before installing


<?php

namespace Platformsh\Cli\Exception;

use GuzzleHttp\Message\RequestInterface;
use GuzzleHttp\Message\ResponseInterface;
use Platformsh\Client\Exception\ApiResponseException;

class HttpException extends \RuntimeException
{
    protected $message = 'An API error occurred.';

    /**
     * @param string            $message
     * @param RequestInterface  $request
     * @param ResponseInterface $response
     */
    public function __construct($message = null, RequestInterface $request = null, ResponseInterface $response = null)
    {
        $message = $message ?: $this->message;
        if ($request !== null && $response !== null) {
            $details = "[url] " . $request->getUrl();
            $details .= " [status code] " . $response->getStatusCode();
            $details .= " [reason phrase] " . $response->getReasonPhrase();
            $details .= ApiResponseException::getErrorDetails($response);
            $message .= "\nDetails:\n  " . wordwrap($details);
        }

        parent::__construct($message, $this->code);
    }
}

<?php

namespace Platformsh\Cli\Exception;

use GuzzleHttp\Message\RequestInterface;
use GuzzleHttp\Message\ResponseInterface;
use Platformsh\Client\Exception\ApiResponseException;

class HttpException extends \RuntimeException
{
    protected $message = 'An API error occurred.';

    /**
     * @param string            $message
     * @param RequestInterface  $request
     * @param ResponseInterface $response
     */
    public function __construct($message = null, RequestInterface $request = null, ResponseInterface $response = null)
    {
        $message = $message ?: $this->message;
        if ($request !== null && $response !== null) {
            $details = "[url] " . $request->getUrl();
            $details .= " [status code] " . $response->getStatusCode();
            $details .= " [reason phrase] " . $response->getReasonPhrase();
            $details .= ApiResponseException::getErrorDetails($response);
            $message .= "\n\nDetails:\n" . $details;
        }

        parent::__construct($message, $this->code);
    }
}

Improve formatting of API error details

Improve formatting of API error details


<article class="post clearfix" id="<?php the_ID(); ?>">
				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_title(); ?>

				<?php the_content(); ?>

			<?php if(!is_page()){ ?>

				<?php echo get_the_date('M. j, Y') ?> | <?php the_category(', '); ?> | <?php comments_number('0 Comments', '1 Comment', '% Comments'); ?>

			<?php } ?>

<article class="post" id="<?php the_ID(); ?>">
				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_title(); ?>

				<?php the_content(); ?>

			<?php if(!is_page()){ ?>

				<?php echo get_the_date('M. j, Y') ?> | <?php the_category(', '); ?> | <?php comments_number('0 Comments', '1 Comment', '% Comments'); ?>

			<?php } ?>

Add clear fixes for the proper tags on post pages


<?php
/**
 * @link https://github.com/himiklab/yii2-sitemap-module
 * @copyright Copyright (c) 2014 HimikLab
 * @license http://opensource.org/licenses/MIT MIT
 */

namespace assayerpro\sitemap\controllers;

use Yii;
use yii\web\Controller;

/**
 * @author HimikLab
 * @package himiklab\sitemap
 */
class DefaultController extends Controller
{
    public function actionIndex()
    {
        /** @var \himiklab\sitemap\Sitemap $module */
        $module = $this->module;

        if (!$sitemapData = $module->cacheProvider->get($module->cacheKey)) {
            $sitemapData = $module->buildSitemap();
        }

        Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
        $headers = Yii::$app->response->headers;
        $headers->add('Content-Type', 'application/xml');
        if ($module->enableGzip) {
            $sitemapData = gzencode($sitemapData);
            $headers->add('Content-Encoding', 'gzip');
            $headers->add('Content-Length', strlen($sitemapData));
        }
        return $sitemapData;
    }
}

<?php
/**
 * @link https://github.com/himiklab/yii2-sitemap-module
 * @copyright Copyright (c) 2014 HimikLab
 * @license http://opensource.org/licenses/MIT MIT
 */

namespace assayerpro\sitemap\controllers;

use Yii;
use yii\web\Controller;

/**
 * @author HimikLab
 * @package himiklab\sitemap
 */
class DefaultController extends Controller
{
    public function actionIndex()
    {
        /** @var \himiklab\sitemap\Sitemap $module */
        $module = Yii::$app->sitemap;

        if (!$sitemapData = $module->cacheProvider->get($module->cacheKey)) {
            $sitemapData = $module->buildSitemap();
        }

        Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
        $headers = Yii::$app->response->headers;
        $headers->add('Content-Type', 'application/xml');
        if ($module->enableGzip) {
            $sitemapData = gzencode($sitemapData);
            $headers->add('Content-Encoding', 'gzip');
            $headers->add('Content-Length', strlen($sitemapData));
        }
        return $sitemapData;
    }
}

Replace module with sitemap component

Replace module with sitemap component


@if (in_array($field->type, array('hidden','auto')) OR !$field->has_wrapper )

    {!! $field->output !!}

    @if ($field->message!='')

        {!! $field->message !!}

    @endif

@else

has_error!!}" id="fg_{!! $field->name !!}">

        @if ($field->has_label)
            name !!}" class="col-sm-2 control-label{!! $field->req !!}">{!! $field->label !!}

name !!}">
        @else

name !!}">
        @endif

            {!! $field->output !!}

            @if(count($field->messages))
                @foreach ($field->messages as $message)

                        {!! $message !!}

                @endforeach
            @endif

@endif

@if (in_array($field->type, array('hidden','auto')) OR !$field->has_wrapper )

    {!! $field->output !!}

    @if ($field->message!='')

        {!! $field->message !!}

    @endif

@else

has_error!!}" id="fg_{!! $field->name !!}" >

        @if ($field->has_label)
            name !!}" class="col-sm-2 control-label{!! $field->req !!}">{!! $field->label !!}

name !!}">
        @else

name !!}">
        @endif

            {!! $field->output !!}

            @if(count($field->messages))
                @foreach ($field->messages as $message)

                        {!! $message !!}

                @endforeach
            @endif

@endif

Fix rendering in show status

Fix rendering in show status

When rendering in the show status, if the labels span multiple lines,
the formatting breaks. Adding the clearfix to the fieldgroup ensures
that each row of the form is correctly rendered.


<?php

declare(strict_types=1);

require_once __DIR__ . "/../app/bootstrap.php";

use DiContainerBenchmarks\Test\TestRunner;

if (isset($_GET["clear"])) {
    opcache_reset();
    exit;
}

if (empty($_GET["test_suite"]) || empty($_GET["test_case"]) || empty($_GET["container"])) {
    echo "
Please specify the required query parameters!
";
    echo "
";
    echo 'test_suite: An integer between 1-6 (inclusive)
';
    echo 'test_case: An integer between 1-3 (inclusive)
';
    echo 'container: The name of the container (e.g.: symfony, php-di, laminas, etc.)
';
    echo "
";
    exit(-1);
}

$testSuiteNumber = (int) $_GET["test_suite"];
$testCaseNumber = (int) $_GET["test_case"];
$container = (string) $_GET["container"];

$testRunner = new TestRunner();
$result = $testRunner->runTest($testSuiteNumber, $testCaseNumber, $container);

echo $result->toJson();

<?php

declare(strict_types=1);

require_once __DIR__ . "/../app/bootstrap.php";

use DiContainerBenchmarks\Test\TestRunner;

if (isset($_GET["opcache"])) {
    echo "
";
    var_dump(opcache_get_status());
    exit;
}

if (isset($_GET["clear"])) {
    opcache_reset();
    exit;
}

if (empty($_GET["test_suite"]) || empty($_GET["test_case"]) || empty($_GET["container"])) {
    echo "
Please specify the required query parameters!
";
    echo "
";
    echo 'test_suite: An integer between 1-6 (inclusive)
';
    echo 'test_case: An integer between 1-3 (inclusive)
';
    echo 'container: The name of the container (e.g.: symfony, php-di, laminas, etc.)
';
    echo "
";
    exit(-1);
}

$testSuiteNumber = (int) $_GET["test_suite"];
$testCaseNumber = (int) $_GET["test_case"];
$container = (string) $_GET["container"];

$testRunner = new TestRunner();

echo $testRunner->runTest($testSuiteNumber, $testCaseNumber, $container)->toJson();

Add subcommand to see opcache status

Add subcommand to see opcache status