<?php
// WIP ?>
<?php $search_query = is_search() ? get_search_query() : ""; ?>
<form class="search-form" action="<?php echo home_url(); ?>" method="get">
    <?php _e("Search for:", "joint-forestry-team"); ?>
    <input class="search-form_input" name="s" title="<?php _e("Search for:", "joint-forestry-team"); ?>" type="search" value="<?php echo $search_query; ?>" />
    <button class="search-form_button" type="submit"><?php _e("Search", "joint-forestry-team"); ?></button>
</form>

<?php $search_query = is_search() ? get_search_query() : ""; ?>
<form class="search-form" action="<?php echo home_url(); ?>" method="get">
    <?php _e("Search for:", "new_site"); ?>
    <input class="search-form_input" name="s" title="<?php _e("Search for:", "new_site"); ?>" type="search" value="<?php echo $search_query; ?>" />
    <button class="search-form_button" type="submit"><?php _e("Search", "new_site"); ?></button>
</form>

Fix namespace on search elements

Fix namespace on search elements


<?php

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

namespace Symfony\Component\Security\Core\Authorization\Voter;

use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Event\VoteEvent;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
 * Decorates voter classes to send result events.
 *
 * @author Laurent VOULLEMIER <laurent.voullemier@gmail.com>
 *
 * @internal
 */
class TraceableVoter implements VoterInterface
{
    private $voter;
    private $eventDispatcher;

    public function __construct(VoterInterface $voter, EventDispatcherInterface $eventDispatcher)
    {
        $this->voter = $voter;
        $this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
    }

    public function vote(TokenInterface $token, $subject, array $attributes)
    {
        $result = $this->voter->vote($token, $subject, $attributes);

        $this->eventDispatcher->dispatch(new VoteEvent($this->voter, $subject, $attributes, $result), 'debug.security.authorization.vote');

        return $result;
    }

    public function getDecoratedVoter(): VoterInterface
    {
        return $this->voter;
    }
}

<?php

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

namespace Symfony\Component\Security\Core\Authorization\Voter;

use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Event\VoteEvent;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
 * Decorates voter classes to send result events.
 *
 * @author Laurent VOULLEMIER <laurent.voullemier@gmail.com>
 *
 * @internal
 */
class TraceableVoter implements VoterInterface
{
    private $voter;
    private $eventDispatcher;

    public function __construct(VoterInterface $voter, EventDispatcherInterface $eventDispatcher)
    {
        $this->voter = $voter;
        $this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
    }

    public function vote(TokenInterface $token, $subject, array $attributes): int
    {
        $result = $this->voter->vote($token, $subject, $attributes);

        $this->eventDispatcher->dispatch(new VoteEvent($this->voter, $subject, $attributes, $result), 'debug.security.authorization.vote');

        return $result;
    }

    public function getDecoratedVoter(): VoterInterface
    {
        return $this->voter;
    }
}

Add more return types after fixing a typo in my script


<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_sharing');
$user = OCP\USER::getUser();
// TODO translations
$toaddress = OCP\Util::sanitizeHtml($_POST['toaddress']);
$type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file';
$subject = $user.' shared a '.$type.' with you';
$link = $_POST['link'];
$text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
OCP\Util::sendMail($toaddress, $toaddress, $subject, $text, $fromaddress, $user);

<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_sharing');
$user = OCP\USER::getUser();
// TODO translations
$type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file';
$subject = $user.' shared a '.$type.' with you';
$link = $_POST['link'];
$text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
OCP\Util::sendMail($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);

Revert santizing toaddress, because PHPMailer now throws exceptions

Conflicts:
	apps/files_sharing/ajax/email.php


<?php

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

declare(strict_types=1);

namespace Sylius\Component\Core\Repository;

use Doctrine\ORM\QueryBuilder;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Product\Repository\ProductRepositoryInterface as BaseProductRepositoryInterface;

interface ProductRepositoryInterface extends BaseProductRepositoryInterface
{
    /**
     * @param mixed|null $taxonId
     */
    public function createListQueryBuilder(string $locale, $taxonId = null): QueryBuilder;

    public function createShopListQueryBuilder(
        ChannelInterface $channel,
        TaxonInterface $taxon,
        string $locale,
        array $sorting = [],
        bool $includeAllDescendants = false
    ): QueryBuilder;

    /**
     * @return array|ProductInterface[]
     */
    public function findLatestByChannel(ChannelInterface $channel, string $locale, int $count): array;

    public function findOneByChannelAndSlug(ChannelInterface $channel, string $locale, string $slug): ?ProductInterface;

    public function findOneByCode(string $code): ?ProductInterface;
}

<?php

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

declare(strict_types=1);

namespace Sylius\Component\Core\Repository;

use Doctrine\ORM\QueryBuilder;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Product\Repository\ProductRepositoryInterface as BaseProductRepositoryInterface;

interface ProductRepositoryInterface extends BaseProductRepositoryInterface
{
    /**
     * @param mixed|null $taxonId
     */
    public function createListQueryBuilder(string $locale, $taxonId = null): QueryBuilder;

    public function createShopListQueryBuilder(
        ChannelInterface $channel,
        TaxonInterface $taxon,
        string $locale,
        array $sorting = [],
        bool $includeAllDescendants = false
    ): QueryBuilder;

    /**
     * @return array|ProductInterface[]
     */
    public function findLatestByChannel(ChannelInterface $channel, string $locale, int $count): array;

    public function findOneByChannelAndSlug(ChannelInterface $channel, string $locale, string $slug): ?ProductInterface;

    public function findOneByChannelAndCode(ChannelInterface $channel, string $code): ?ProductInterface;

    public function findOneByCode(string $code): ?ProductInterface;
}

[API][Product] Change identifier for shop endpoint from slug to code


<?php

/**
 * Delete the property value from the database.
 *
 * @param string $type
 * @param string $slug
 * @param int    $post_id
 */
function papi_action_delete_value( $type, $slug, $post_id = 0 ) {
	do_action( 'papi/delete_value/' . $type, $slug, $post_id );
}

/**
 * Fire the 'papi/include' action, where plugins should include files.
 */
function papi_action_include() {
	do_action( 'papi/include' );
}

<?php

/**
 * Delete the property value from the database.
 *
 * @param string $type
 * @param string $slug
 * @param int    $post_id
 */
function papi_action_delete_value( $type, $slug, $post_id = 0 ) {
	do_action( 'papi/delete_value/' . $type, $slug, $post_id );
}

/**
 * Fire the 'papi/include' action, where plugins should include files.
 */
function papi_action_include() {
	did_action( 'papi/include' ) || do_action( 'papi/include' );
}

Fix so include action is only run if did_action returns false


<?php

final class CM_EventHandler_EventHandler {

	/**
	 * @var array $_callbacks
	 */
	private $_callbacks = array();

	/**
	 * @param string                          $event
	 * @param CM_Jobdistribution_Job_Abstract $job
	 * @param array|null                      $params
	 */
	public function bindJob($event, CM_Jobdistribution_Job_Abstract $job, array $params = null) {
		$event = (string) $event;
		$this->_callbacks[$event][] = array('job' => $job, 'params' => $params);
	}

	/**
	 * @param string $event
	 */
	public function unbind($event) {
		$event = (string) $event;
		unset($this->_callbacks[$event]);
	}

	/**
	 * @param string     $event
	 * @param array|null $params
	 */
	public function trigger($event, array $params = null) {
		$event = (string) $event;
		if (!$params) {
			$params = array();
		}
		if (!empty($this->_callbacks[$event])) {
			foreach ($this->_callbacks[$event] as $callback) {
				$jobParams = $params;
				if (!empty($callback['params'])) {
					$jobParams = array_merge($callback['params'], $jobParams);
				}
				/** @var CM_Jobdistribution_Job_Abstract $job */
				$job = $callback['job'];
				$job->queue($jobParams);
			}
		}
	}
}

<?php

final class CM_EventHandler_EventHandler {

	/**
	 * @var array $_callbacks
	 */
	private $_callbacks = array();

	/**
	 * @param string                          $event
	 * @param CM_Jobdistribution_Job_Abstract $job
	 * @param array                           $jobParams
	 */
	public function bindJob($event, CM_Jobdistribution_Job_Abstract $job, array $jobParams = null) {
		$event = (string) $event;
		$jobParams = (array) $jobParams;
		$this->bind($event, function($params) use ($job, $jobParams) {
			$params = array_merge($jobParams, $params);
			$job->queue($params);
		});
	}

	/**
	 * @param string $event
	 * @param closure $callback
	 */
	public function bind($event, Closure $callback) {
		$event = (string) $event;
		$this->_callbacks[$event][] = $callback;
	}

	/**
	 * @param string $event
	 */
	public function unbind($event) {
		$event = (string) $event;
		unset($this->_callbacks[$event]);
	}

	/**
	 * @param string     $event
	 * @param array|null $params
	 */
	public function trigger($event, array $params = null) {
		$event = (string) $event;
		if (!$params) {
			$params = array();
		}
		if (!empty($this->_callbacks[$event])) {
			foreach ($this->_callbacks[$event] as $callback) {
				call_user_func($callback, $params);
			}
		}
	}
}

Add Event_Handler->bind() method accepting closure callbacks

- add bind method
- use bind method within bindJob method


<?php
    echo "\n\n";
    echo "================\n";
    echo pluralize( count( $unittests ), 'unit test' ) . "\n";
    echo "================\n\n";
?>
<?php
    foreach ( $unittests as $unittest ) {
        echo "\n";
        ?>## Unit test: <?php
        echo $unittest->testName;
        ?>, with <?php
            echo pluralize( count( $unittest->tests ), 'test method' );
        ?> ##<?php
        echo "\n\n";

        foreach ( $unittest->tests as $test ) {
            echo $test->methodName . ":\n";
            if ( $test->success ) {
                ?>PASS - <?php
                echo pluralize( $test->assertCount, 'assertion' );
                echo "\n";
            }
            else {
                ?>FAIL: <?php
                echo $test->error;
                echo "\n";
                require 'views/testrun/calltrace.txt.php';
            }
        }
    }
?>

<?php
    echo "\n\n";
    echo "================\n";
    echo pluralize( count( $unittests ), 'unit test' ) . "\n";
    echo "================\n\n";

    foreach ( $unittests as $unittest ) {
        echo "\n";
        ?>## Unit test: <?php
        echo $unittest->testName;
        ?>, with <?php
            echo pluralize( count( $unittest->tests ), 'test method' );
        ?> ##<?php
        echo "\n\n";

        foreach ( $unittest->tests as $test ) {
            echo $test->methodName . ":\n";
            if ( $test->success ) {
                ?>PASS - <?php
                echo pluralize( $test->assertCount, 'assertion' );
                echo "\n";
            }
            else {
                ?>FAIL: <?php
                echo $test->error;
                echo "\n";
                require 'views/testrun/calltrace.txt.php';
            }
        }
    }
?>

Fix redundant open/close php tag

Fix redundant open/close php tag


<?php

if (file_exists(__DIR__ . '../vendor/autoload.php')) {
    require_once __DIR__ . '../vendor/autoload.php';
}

Object::add_extension('ContentController', 'HashPathExtension');

<?php

if (file_exists(__DIR__ . '../vendor/autoload.php')) {
    require_once __DIR__ . '../vendor/autoload.php';
}

if (class_exists('ContentController')) {
    Object::add_extension('ContentController', 'HashPathExtension');
}

BUGFIX: Fix issue where content controller is not defined


{{--
    Copyright 2015-2017 ppy Pty. Ltd.

    This file is part of osu!web. osu!web is distributed with the hope of
    attracting more community contributions to the core ecosystem of osu!.

    osu!web is free software: you can redistribute it and/or modify
    it under the terms of the Affero GNU General Public License version 3
    as published by the Free Software Foundation.i
    osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    See the GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with osu!web.  If not, see <http://www.gnu.org/licenses/>.
--}}
version === $stream->version ? 'changelog-stream--active' : '' }}
        changelog-stream--{{ str_slug($stream->updateStream->pretty_name) }}
    "
    href={{ route('changelog', ['build' => $stream->version]) }}
  >

        {{ $stream->updateStream->pretty_name }}
        {{ $stream->version }}
        {{ trans_choice('changelog.users-online', $stream->users, ['users' => $stream->users]) }}

Fix recent changes page not working

Fix recent changes page not working


<?php

function export_posts_as_csv() {

	$args = array(
        'posts_per_page'    => -1,
        'post_type'         => 'pages',
        'post_status'       => array( 'publish', 'pending' ),
        'orderby'           => 'title',
        'order'             => 'ASC'
    );
    query_posts( $args );

    header( 'Content-Type: text/csv' );
    header( 'Content-Disposition: attachment;filename=my_pages.csv');

    $output = fopen( 'php://output', 'w' );
    fputcsv( $output, array( 'Nr', 'Page_ID', 'Page_Title', 'Page_Status' ) );

    $i = 1;
    while( have_posts() ) : the_post();

	fputcsv( $output, array( $i, get_the_ID(), get_the_title(), get_post_status() ) );
	$i++;

    endwhile;
    wp_reset_query();

    fclose( $output );
    die;
}

?>

Add PHP's open and closing tags

Add PHP's open and closing tags


<?php

spl_autoload_register(function($classname) {
    if (0 === strpos($classname, "XLSXExporter")) {
        require_once dirname(__DIR__)."/".str_replace("\\", "/", $classname).".php";
    }
});

<?php

spl_autoload_register(function($classname) {
    if (0 === strpos($classname, "XLSXExporter\\")) {
        require_once dirname(__DIR__)."/XLSXExporter/".str_replace("\\", "/", $classname).".php";
    }
});

Add a '\' after XLSXExporter

Add a '\' after XLSXExporter


<?php

namespace raphiz\passwordcards;

class PDFRenderer
{
    public static function render($front, $back)
    {
        // create new PDF document
        $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, 'mm', 'A4', true, 'UTF-8', false);

        // set document information
        $pdf->SetAuthor('Raphael Zimmermann');
        $pdf->SetTitle('Password Card');
        $pdf->SetSubject('Password Card');

        $pdf->SetPrintHeader(false);
        $pdf->SetPrintFooter(false);

        // add a page
        $pdf->AddPage();

        // Mark the position to fold...
        $pdf->Line(95, 10, 95, 13);
        $pdf->Line(95, 72, 95, 75);

        // Add the front svg
        $pdf->ImageSVG(
            $file = $front,
            $x = 10,
            $y = 15,
            $w = '85',
            $h = '55'
        );

        // Add the back svg
        $pdf->ImageSVG(
            $file = $back,
            $x = 95,
            $y = 15,
            $w = '85',
            $h = '55'
        );

        //Close and output PDF document
        return $pdf->Output('generated.pdf', 'S');
    }
}

<?php

namespace raphiz\passwordcards;

class PDFRenderer
{
    public static function render($front, $back)
    {
        // create new PDF document
        $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, 'mm', 'A4', true, 'UTF-8', false);

        // set document information
        $pdf->SetAuthor('Raphael Zimmermann');
        $pdf->SetTitle('Password Card');
        $pdf->SetSubject('Password Card');

        $pdf->SetPrintHeader(false);
        $pdf->SetPrintFooter(false);

        // add a page
        $pdf->AddPage();

        // Mark the position to fold...
        $pdf->Line(95, 10, 95, 13);
        $pdf->Line(95, 72, 95, 75);

        // Add the front svg
        $pdf->ImageSVG(
            $front, // filename
            10, // x
            15, // y
            '85', // width
            '55' // height
        );

        // Add the back svg
        $pdf->ImageSVG(
            $back, // filename
            95, // x
            15, // y
            '85', // width
            '55' // height
        );

        //Close and output PDF document
        return $pdf->Output('generated.pdf', 'S');
    }
}

Remove "named" parameters when calling ImageSVG in class PDFRendere


<?php

namespace App;

use Matthias\SymfonyConsoleForm\Bundle\SymfonyConsoleFormBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Kernel as SymfonyKernel;

class Kernel extends SymfonyKernel
{
    /** @var string */
    private $vendorDirectory;

    public function __construct(string $environment, bool $debug, string $vendorDirectory)
    {
        parent::__construct($environment, $debug);
        $this->vendorDirectory = $vendorDirectory;
    }

    public function registerBundles(): array
    {
        return [
            new FrameworkBundle(),
            new TwigBundle(),
            new SymfonyConsoleFormBundle(),
        ];
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__ . '/config.yml');

        if ($this->environment === 'test') {
            $loader->load(__DIR__ . '/config_test.yml');
        }
    }

    public function getCacheDir(): string
    {
        return __DIR__ . '/cache';
    }

    public function getLogDir(): string
    {
        return __DIR__ . '/logs';
    }

    protected function buildContainer(): ContainerInterface
    {
        $container = parent::buildContainer();

        $container->setParameter('vendor_directory', $this->vendorDirectory);

        return $container;
    }
}

<?php

namespace App;

use Matthias\SymfonyConsoleForm\Bundle\SymfonyConsoleFormBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Kernel as SymfonyKernel;

class Kernel extends SymfonyKernel
{
    /** @var string */
    private $vendorDirectory;

    public function __construct(string $environment, bool $debug, string $vendorDirectory)
    {
        parent::__construct($environment, $debug);
        $this->vendorDirectory = $vendorDirectory;
    }

    public function registerBundles(): array
    {
        return [
            new FrameworkBundle(),
            new TwigBundle(),
            new SymfonyConsoleFormBundle(),
        ];
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__ . '/config.yml');

        if ($this->environment === 'test') {
            $loader->load(__DIR__ . '/config_test.yml');
        }
    }

    public function getCacheDir(): string
    {
        return __DIR__ . '/cache/' . $this->environment;
    }

    public function getLogDir(): string
    {
        return __DIR__ . '/logs/' . $this->environment;
    }

    protected function buildContainer(): ContainerInterface
    {
        $container = parent::buildContainer();

        $container->setParameter('vendor_directory', $this->vendorDirectory);

        return $container;
    }
}

Use separate cache and log directory per environment


<?php

namespace Taskforcedev\CrudAPI\Http\Controllers;

use Illuminate\Http\Request;
use Taskforcedev\CrudAPI\Models\CrudModel;

/**
 * Class AdminController
 *
 * @package Taskforcedev\CrudAPI\Http\Controllers
 */
class AdminController extends Controller
{
    /**
     * @param string $model The model to list.
     */
    public function index($model)
    {
        $model = $this->getModel($model);
        $data = $model->all();
        echo '<pre>';
        print_r($data);
        echo '</pre>';

        return view('crud-api::admin.index');
    }
}

<?php

namespace Taskforcedev\CrudAPI\Http\Controllers;

use Illuminate\Http\Request;
use Taskforcedev\CrudAPI\Models\CrudModel;

/**
 * Class AdminController
 *
 * @package Taskforcedev\CrudAPI\Http\Controllers
 */
class AdminController extends Controller
{
    /**
     * @param string $model The model to list.
     */
    public function index($model)
    {
        $model = $this->getModel($model);
        $data = $model->all();

        return view('crud-api::admin.index', $data);
    }
}

Remove print, pass data to view

Remove print, pass data to view


<?php
/*
 * Same configuration as Laravel 5.2:
 * See https://github.com/laravel/framework/blob/5.2/src/Illuminate/Auth/Console/stubs/make/routes.stub
 */
Route::group(['middleware' => 'web'], function () {
    Route::auth();

    Route::get('/home', 'HomeController@index');
});

<?php
/*
 * Same configuration as Laravel 5.2:
 * See https://github.com/laravel/framework/blob/5.2/src/Illuminate/Auth/Console/stubs/make/routes.stub
 */
Route::group(['middleware' => 'web'], function () {
    Route::auth();

    Route::get('/home', 'HomeController@index');

    Route::get('/', function () {
        return view('welcome');
    });
});

Put welcome page inside web middleware to allow check user existance and not show Login and Register links when user is logged


<?php
namespace ComplexPie;

class DOMIterator implements \Iterator
{
    private $root;
    private $node;
    private $position = 0;

    public function __construct(\DOMNode $root)
    {
        $this->root = $root;
        $this->rewind();
    }

    public function rewind()
    {
        $this->position = 0;
        $this->node = $this->root;
    }

    public function current()
    {
        return $this->node;
    }

    public function key()
    {
        return $this->position;
    }

    public function next()
    {
        $this->position++;
        if ($this->node->firstChild)
        {
            $this->node = $this->node->firstChild;
        }
        elseif ($this->node->nextSibling)
        {
            $this->node = $this->node->nextSibling;
        }
        elseif ($this->node->parentNode &&
                $this->node->parentNode !== $this->root &&
                $this->node->parentNode->nextSibling)
        {
            $this->node = $this->node->parentNode->nextSibling;
        }
        else
        {
            $this->node = null;
        }
    }

    public function valid()
    {
        return $this->node;
    }
}

<?php
namespace ComplexPie;

class DOMIterator implements \Iterator
{
    private $root;
    private $node;
    private $position = 0;

    public function __construct(\DOMNode $root)
    {
        $this->root = $root;
        $this->rewind();
    }

    public function rewind()
    {
        $this->position = 0;
        $this->node = $this->root;
    }

    public function current()
    {
        return $this->node;
    }

    public function key()
    {
        return $this->position;
    }

    public function next()
    {
        $this->position++;
        if ($this->node->firstChild)
        {
            $this->node = $this->node->firstChild;
        }
        elseif ($this->node->nextSibling)
        {
            $this->node = $this->node->nextSibling;
        }
        else
        {
            $parent = $this->node;
            while (($parent = $parent->parentNode) &&
                   $parent !== $this->root)
            {
                if ($parent->nextSibling)
                {
                    $this->node = $parent->nextSibling;
                    return;
                }
            }
            $this->node = null;
        }
    }

    public function valid()
    {
        return $this->node;
    }
}

Fix ancestor next sibling test for DOMIterator.


#!/usr/bin/php
<?php
chdir(dirname(__FILE__).'/..');
require './global.php';

/**
 * Install the schemas in the correct order. Add your own class names to the
 *   $third_party_model_classes array in install-3rdparty-schema.php.
 *
 * @copyright Copyright (c) 2011 Poluza.
 * @author Andrew Udvare [au] <andrew@poluza.com>
 * @license http://www.opensource.org/licenses/mit-license.php
 *
 * @package SutraScripts
 * @link http://www.example.com/
 *
 * @version 1.0
 */
function sutraInstallSchemas() {
  $classes = array(
    'User',
    'Category',
    'CompiledJavascriptFile',
    'ContactMailMessage',
    'ResetPasswordRequest',
    'RouterAlias',
    'SiteVariable',
    'UserVerification',
  );
  $schema_sql = '';
  $model_classes_path = sLoader::getModelClassesPath();

  require './scripts/install-3rdparty-schema.php';

  foreach ($classes as $class) {
    $schema_sql .= file_get_contents($model_classes_path.$class.'.sql');
  }

  sDatabase::getInstance()->translatedExecute($schema_sql);
}

sutraInstallSchemas();

#!/usr/bin/php
<?php
/**
 * Install the schemas in the correct order. Add your own class names to the
 *   $third_party_model_classes array in install-3rdparty-schema.php.
 *
 * @copyright Copyright (c) 2011 Poluza.
 * @author Andrew Udvare [au] <andrew@poluza.com>
 * @license http://www.opensource.org/licenses/mit-license.php
 *
 * @package SutraScripts
 * @link http://www.example.com/
 *
 * @version 1.0
 */

try {
  // Find the site root
  while (!is_file('./global.php')) {
    if (!chdir('..')) {
      throw new Exception('Cannot find site root.');
    }
  }

  require './global.php';

  if (!class_exists('fCore') || !class_exists('sDatabase')) {
    throw new Exception('Site root contains global.php but is invalid.');
  }

  $classes = array(
    'User',
    'Category',
    'CompiledJavascriptFile',
    'ContactMailMessage',
    'ResetPasswordRequest',
    'RouterAlias',
    'SiteVariable',
    'UserVerification',
  );
  $schema_sql = '';
  $model_classes_path = sLoader::getModelClassesPath();

  foreach ($classes as $class) {
    $schema_sql .= file_get_contents($model_classes_path.$class.'.sql');
  }

  fCore::enableDebugging(TRUE);
  sDatabase::getInstance()->translatedExecute($schema_sql);
}
catch (fSQLException $e) {
  print 'Caught fSQLException: '.strip_tags($e->getMessage())."\n";
  exit(1);
}
catch (Exception $e) {
  print $e->getMessage();
  exit(1);
}

Update to run from site root

Update to run from site root


<?php

/*
 * This file is part of Laravel Algolia.
 *
 * (c) Vincent Klaiber <hello@vinkla.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Vinkla\Tests\Algolia;

use AlgoliaSearch\Client;
use GrahamCampbell\TestBenchCore\ServiceProviderTrait;
use Vinkla\Algolia\AlgoliaFactory;
use Vinkla\Algolia\AlgoliaManager;

/**
 * This is the service provider test class.
 *
 * @author Vincent Klaiber <hello@vinkla.com>
 */
class ServiceProviderTest extends AbstractTestCase
{
    use ServiceProviderTrait;

    public function testAlgoliaFactoryIsInjectable()
    {
        $this->assertIsInjectable(AlgoliaFactory::class);
    }

    public function testAlgoliaManagerIsInjectable()
    {
        $this->assertIsInjectable(AlgoliaManager::class);
    }

    public function testBindings()
    {
        $this->assertIsInjectable(Client::class);

        $original = $this->app['algolia.connection'];
        $this->app['algolia']->reconnect();
        $new = $this->app['algolia.connection'];

        $this->assertNotSame($original, $new);
        $this->assertEquals($original, $new);
    }
}

<?php

/*
 * This file is part of Laravel Algolia.
 *
 * (c) Vincent Klaiber <hello@vinkla.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Vinkla\Tests\Algolia;

use AlgoliaSearch\Client;
use GrahamCampbell\TestBenchCore\ServiceProviderTrait;
use Vinkla\Algolia\AlgoliaFactory;
use Vinkla\Algolia\AlgoliaManager;

/**
 * This is the service provider test class.
 *
 * @author Vincent Klaiber <hello@vinkla.com>
 */
class ServiceProviderTest extends AbstractTestCase
{
    use ServiceProviderTrait;

    public function testAlgoliaFactoryIsInjectable()
    {
        $this->assertIsInjectable(AlgoliaFactory::class);
    }

    public function testAlgoliaManagerIsInjectable()
    {
        $this->assertIsInjectable(AlgoliaManager::class);
    }

    public function testBindings()
    {
        $this->assertIsInjectable(Client::class);

        $original = $this->app['algolia.connection'];
        $this->app['algolia']->reconnect();
        $new = $this->app['algolia.connection'];

        $this->assertNotSame($original, $new);
        $this->assertSame(get_class($original), get_class($new));
    }
}

Check that it returns the same class

Check that it returns the same class


<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.

$loader = new ApcClassLoader('sf2', $loader);
$loader->register(true);

require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.

$loader = new ApcClassLoader('symfony2Benchmark', $loader);
$loader->register(true);

require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Update to apc class loader config

Update to apc class loader config


<?php
define("DEBUG", true);
define("DBNAME", 'ssbin');
define("DBUSER", 'fandi');
define("DBPASS", 'borera');
define("DBPORT", 34600);

define("PHPMAILER_FROM", 'noreply@icodeformoney.com');
define("PHPMAILER_PASS", "Haha23235");
define("PHPMAILER_NAME", 'SSBIN noreply');
define("PHPMAILER_HOST", 'lax215.arandomserver.com');
define("PHPMAILER_PORT", 26);

define("APPNAME", "SSBIN");
define("DOMAIN", "https://ssbin.loc");

<?php
define("DEBUG", true);
define("DBNAME", 'ssbin');
define("DBUSER", 'fandi');
define("DBPASS", 'borera');
define("DBPORT", 34600);

define("PHPMAILER_FROM", 'noreply@icodeformoney.com');
define("PHPMAILER_PASS", "Haha23235");
define("PHPMAILER_NAME", 'SSBIN noreply');
define("PHPMAILER_HOST", 'lax215.arandomserver.com');
define("PHPMAILER_PORT", 26);

define("APPNAME", "SSBIN");
define("DOMAIN", "http://ssbin.loc");

Update DOMAIN harusnya http, bukan https.


<?php

/**
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * @version 1.1 beta 1
 *
 */

// Version Constants
const CURRENT_VERSION = '1.1';
const CURRENT_LANG_VERSION = '1.1';
const DB_SCRIPT_VERSION = '1-1';
const REQUIRED_PHP_VERSION = '5.3.3';

// String constants
const SITE_SOFTWARE = 'http://www.elkarte.net';

function getUpgradeFiles()
{
	global $db_type;

	return array(
		array('upgrade_1-0.php', '1.0', CURRENT_VERSION),
		array('upgrade_1-0_' . $db_type . '.php', '1.0', CURRENT_VERSION),
		array('upgrade_1-1.php', '1.1', CURRENT_VERSION),
		array('upgrade_1-1_' . $db_type . '.php', '1.1', CURRENT_VERSION),
	);
}

<?php

/**
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * @version 1.1 beta 1
 *
 */

// Version Constants
const CURRENT_VERSION = '1.1 beta 1';
const CURRENT_LANG_VERSION = '1.1';
const DB_SCRIPT_VERSION = '1-1';
const REQUIRED_PHP_VERSION = '5.3.3';

// String constants
const SITE_SOFTWARE = 'http://www.elkarte.net';

function getUpgradeFiles()
{
	global $db_type;

	return array(
		array('upgrade_1-0.php', '1.0', '1.0'),
		array('upgrade_1-0_' . $db_type . '.php', '1.0', '1.0'),
		array('upgrade_1-1.php', '1.1 beta 1', CURRENT_VERSION),
		array('upgrade_1-1_' . $db_type . '.php', '1.1 beta 1', CURRENT_VERSION),
	);
}

Fix Elk versions for upgrade files

Fix Elk versions for upgrade files


<?php

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

require_once(dirname(__FILE__).'/../autoload/sfCoreAutoload.class.php');
sfCoreAutoload::register();

try
{
  $dispatcher = new sfEventDispatcher();
  $logger = new sfCommandLogger($dispatcher);

  $application = new sfSymfonyCommandApplication($dispatcher, null, array('symfony_lib_dir' => realpath(dirname(__FILE__).'/..')));
  $statusCode = $application->run();
}
catch (Exception $e)
{
  if (!isset($application))
  {
    throw $e;
  }

  $application->renderException($e);
  $statusCode = $e->getCode();

  exit(is_numeric($statusCode) && $statusCode ? $statusCode : 1);
}

exit(is_numeric($statusCode) ? $statusCode : 0);

<?php

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

// Try autoloading using composer if available.
if (!file_exists($autoload = dirname(__FILE__).'/../../../../autoload.php'))
{
  $autoload = dirname(__FILE__).'/../../autoload.php';
}
require_once $autoload;

try
{
  $dispatcher = new sfEventDispatcher();
  $logger = new sfCommandLogger($dispatcher);

  $application = new sfSymfonyCommandApplication($dispatcher, null, array('symfony_lib_dir' => realpath(dirname(__FILE__).'/..')));
  $statusCode = $application->run();
}
catch (Exception $e)
{
  if (!isset($application))
  {
    throw $e;
  }

  $application->renderException($e);
  $statusCode = $e->getCode();

  exit(is_numeric($statusCode) && $statusCode ? $statusCode : 1);
}

exit(is_numeric($statusCode) ? $statusCode : 0);

Use composer autoload file when available

Fix task symfony generate:project with sfDoctrinePlugin  (GH-10)


<?php

namespace App\Http\Controllers;

use App\Mail\ResumeDownloaded;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class DownloadResumeController extends Controller
{
    public function __invoke(Request $request)
    {
        $this->validate($request, [
            'email' => 'required|email',
        ], [
            'email.required' => 'To be fair, you could enter any valid email and you would still be able to download my resume.
So if you really want it that badly then here, use gimme@example.com',
            'email.email' => 'To be fair, you could enter any valid email and you would still be able to download my resume.
So if you really want it that badly then here, use gimme@example.com',
        ]);

        Mail::to(config('mail.from.address'))
            ->send(new ResumeDownloaded($request->input('email')));

        return response()->download(storage_path('app/resume.pdf'), 'Tonning, Kristoffer - Resume');
    }
}

<?php

namespace App\Http\Controllers;

use App\Mail\ResumeDownloaded;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class DownloadResumeController extends Controller
{
    public function __invoke(Request $request)
    {
        $this->validate($request, [
            'email' => 'required|email',
        ], [
            'email.required' => 'To be fair, you could enter any valid email and you would still be able to download my resume.
So if you really want it that badly then here, use gimme@example.com',
            'email.email' => 'To be fair, you could enter any valid email and you would still be able to download my resume.
So if you really want it that badly then here, use gimme@example.com',
        ]);

        Mail::to(config('mail.from.address'))
            ->send(new ResumeDownloaded($request->input('email')));

        return response()->download(storage_path('app/resume.pdf'), 'Tonning, Kristoffer - Resume.pdf');
    }
}

Fix missing resume file extension

Fix missing resume file extension


<?php

$zf2Path = realpath(__DIR__ . '/../vendor/zf2/library/');
set_include_path($zf2Path . PATH_SEPARATOR . get_include_path());

require 'Zend/Loader/AutoloaderFactory.php';
use Zend\Loader\AutoloaderFactory;

//Autoloading
AutoloaderFactory::factory(array(
	'Zend\Loader\StandardAutoloader' => array(
		'namespaces' => array(
			'MASchoolManagement' => __DIR__ . '/../src/library/MASchoolManagement',
		),
	),
));

<?php

$zf2Path = '/var/php/library/zf2/library/';
set_include_path($zf2Path . PATH_SEPARATOR . get_include_path());

require 'Zend/Loader/AutoloaderFactory.php';
use Zend\Loader\AutoloaderFactory;

//Autoloading
AutoloaderFactory::factory(array(
	'Zend\Loader\StandardAutoloader' => array(
		'namespaces' => array(
			'MASchoolManagement' => __DIR__ . '/../src/library/MASchoolManagement',
		),
	),
));

Use hardcoded path for zend

Use hardcoded path for zend


<?php

function includeIfExists($file) {
  if (file_exists($file))
    return include $file;
}

if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) &&
      (!$loader = includeIfExists(__DIR__.'/../../../.composer/autoload.php')))
  die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
      'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
      'php composer.phar install'.PHP_EOL);

$loader->add('Amalfra\SupportBee\Tests', __DIR__);
return $loader;

<?php

function includeIfExists($file) {
  if (file_exists($file)) {
    return include $file;
  }
}

if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) &&
      (!$loader = includeIfExists(__DIR__.'/../../../.composer/autoload.php'))) {
  die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
      'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
      'php composer.phar install'.PHP_EOL);
}

$loader->add('Amalfra\SupportBee\Tests', __DIR__);
return $loader;

Add curly braces around ifs

Add curly braces around ifs


		<?php if ($sidebar_left || $sidebar_right): ?>

				<?php echo $sidebar_left; ?>
				<?php echo $sidebar_right; ?>

		<?php endif; ?>

				<?php if ($title): ?>

  <?php echo $title;?>

				<?php endif; ?>

				<?php if ($messages): ?>

						<?php echo $messages ?>

				<?php endif; ?>

				<?php if ($tabs): ?>

<?php echo $tabs; ?>

				<?php endif;?>
				<div id="content-body" class="<?php echo $tabs ? 'with-tabs' : 'without-tabs'?>">
					<?php echo $content; ?>

		<?php if ($sidebar_left || $sidebar_right): ?>

				<?php echo $sidebar_left; ?>
				<?php echo $sidebar_right; ?>

		<?php endif; ?>

				<?php if ($title): ?>

  <?php echo $title;?>

				<?php endif; ?>

					<?php if ($messages): ?>

							<?php echo $messages ?>

					<?php endif; ?>

					<?php if ($tabs): ?>

<?php echo $tabs; ?>

					<?php endif; ?>

					<div id="content-body" class="<?php echo $tabs ? 'with-tabs' : 'without-tabs'?>">
						<?php echo $content; ?>

Update feature: Cleanup admin layout

Update feature: Cleanup admin layout


<?php

namespace Oro\Bundle\ImapBundle\Form\EventListener;

use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DecodeFolderSubscriber implements EventSubscriberInterface
{
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            FormEvents::PRE_SUBMIT   => ['decodeFolders', 255]
        ];
    }

    /**
     * Decode folders from json pack
     *
     * @param FormEvent $event
     */
    public function decodeFolders(FormEvent $event)
    {
        $data = $event->getData();
        if (!$data || !is_array($data) || !array_key_exists('folders', $data)) {
            return;
        }

        if (!is_string($data['folders'])) {
            return;
        }

        $data['folders'] = json_decode($data['folders'], true);
        $event->setData($data);
    }
}

<?php

namespace Oro\Bundle\ImapBundle\Form\EventListener;

use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DecodeFolderSubscriber implements EventSubscriberInterface
{
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            FormEvents::PRE_SUBMIT   => ['decodeFolders', 255]
        ];
    }

    /**
     * Decode folders from json pack
     *
     * @param FormEvent $event
     */
    public function decodeFolders(FormEvent $event)
    {
        $data = $event->getData();
        if (!$data || !is_array($data) || !array_key_exists('folders', $data)) {
            return;
        }

        if (!is_string($data['folders'])) {
            return;
        }

        $data['folders'] = json_decode($data['folders'], true);
        $event->setData($data);
    }
}

CRM-4553: Fix undefined index notice and array_pop() PHP Warning in functional tests
- delete unused use


<?php

declare (strict_types = 1);

namespace Mihaeu\PhpDependencies;

abstract class AbstractCollection implements Collection
{
    /** @var array */
    protected $collection = [];

    /**
     * {@inheritdoc}
     */
    public function each(\Closure $closure)
    {
        foreach ($this->collection as $item) {
            $closure($item);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function mapToArray(\Closure $closure) : array
    {
        return array_map($closure, $this->collection);
    }

    /**
     * {@inheritdoc}
     */
    public function reduce($initial, \Closure $closure)
    {
        return array_reduce($this->collection, $closure, $initial);
    }

    /**
     * {@inheritdoc}
     */
    public function filter(\Closure $closure) : Collection
    {
        $clone = clone $this;
        $clone->collection = array_filter($this->collection, $closure);

        return $clone;
    }

    /**
     * {@inheritdoc}
     */
    public function toArray() : array
    {
        return $this->collection;
    }

    /**
     * {@inheritdoc}
     */
    public function count()
    {
        return count($this->collection);
    }
}

<?php

declare (strict_types = 1);

namespace Mihaeu\PhpDependencies;

abstract class AbstractCollection implements Collection
{
    /** @var array */
    protected $collection = [];

    /**
     * {@inheritdoc}
     */
    public function each(\Closure $closure)
    {
        foreach ($this->collection as $item) {
            $closure($item);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function mapToArray(\Closure $closure) : array
    {
        return array_map($closure, $this->collection);
    }

    /**
     * {@inheritdoc}
     */
    public function reduce($initial, \Closure $closure)
    {
        return array_reduce($this->collection, $closure, $initial);
    }

    /**
     * {@inheritdoc}
     */
    public function filter(\Closure $closure) : Collection
    {
        $clone = clone $this;
        $clone->collection = array_values(array_filter($this->collection, $closure));

        return $clone;
    }

    /**
     * {@inheritdoc}
     */
    public function toArray() : array
    {
        return $this->collection;
    }

    /**
     * {@inheritdoc}
     */
    public function count()
    {
        return count($this->collection);
    }
}

Fix bad indices for filtered collection

Fix bad indices for filtered collection

array_filter returns the indices of the original array which
might not be continuous and cause unexpected results when
transforming the Collection using toArray().


<?php
/**
 * Created by PhpStorm.
 * User: jam
 * Date: 11.1.15
 * Time: 20:34
 */

namespace Trejjam\Authorization;

use Nette,
	Trejjam;

class User extends Nette\Security\User
{
	/**
	 * @var UserStorage
	 */
	protected $storage;

	protected $reloadChangedUser;

	public function __construct(UserStorage $storage, Nette\Security\IAuthenticator $authenticator = NULL, Nette\Security\IAuthorizator $authorizator = NULL) {
		parent::__construct($storage, $authenticator, $authorizator);

		$this->storage = $storage;
	}

	public function setParams($reloadChangedUser) {
		$this->reloadChangedUser = $reloadChangedUser;

		if ($reloadChangedUser) {
			$this->checkIdentityAction();
		}
	}

	protected function checkIdentityAction() {
		if ($this->storage->isAuthenticated()) {
			$action = $this->storage->getAction();

			if (is_null($action)) {
				$this->logout();
			}

			switch ($action) {
				case 'reload':
					$this->storage->setAction('destroyed');
					$this->login($this->getId(), NULL);

					break;
				case 'logout':
					$this->storage->setAction('destroyed');
					$this->logout();

					break;
				case 'destroyed':
					$this->logout();

					break;
			}
		}
	}
}

<?php
/**
 * Created by PhpStorm.
 * User: jam
 * Date: 11.1.15
 * Time: 20:34
 */

namespace Trejjam\Authorization;

use Nette,
	Trejjam;

class User extends Nette\Security\User
{
	/**
	 * @var UserStorage
	 */
	protected $storage;

	protected $reloadChangedUser;

	public function __construct(UserStorage $storage, Nette\Security\IAuthenticator $authenticator = NULL, Nette\Security\IAuthorizator $authorizator = NULL) {
		parent::__construct($storage, $authenticator, $authorizator);

		$this->storage = $storage;
	}

	public function setParams($reloadChangedUser) {
		$this->reloadChangedUser = $reloadChangedUser;

		if ($reloadChangedUser) {
			$this->checkIdentityAction();
		}
	}

	public function logout($clearIdentity = FALSE) {
		$this->storage->setAction('destroyed');

		parent::logout($clearIdentity);
	}
	protected function checkIdentityAction() {
		if ($this->storage->isAuthenticated()) {
			$action = $this->storage->getAction();

			if (is_null($action)) {
				parent::logout();
			}

			switch ($action) {
				case 'reload':
					$this->login($this->getId(), NULL);

					break;
				case 'logout':
					$this->logout();

					break;
				case 'destroyed':
					$this->logout();

					break;
			}
		}
	}
}

Fix destroy DB hash if user logout

Fix destroy DB hash if user logout


<?php
namespace PHPAPILibrary\Core\Data;

/**
 * Interface DataInterface
 * @package PHPAPILibrary\Core\Data
 */
interface DataInterface
{
    //Marker interface
}

<?php
namespace PHPAPILibrary\Core\Data;

/**
 * Interface DataInterface
 * @package PHPAPILibrary\Core\Data
 */
interface DataInterface extends \Serializable
{
    //Marker interface
}

Make data serializable, so its more than a marker. Useful for queuing.


<?php namespace Anomaly\PagesModule\Page;

use Anomaly\PagesModule\Page\Contract\PageInterface;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
use Anomaly\Streams\Platform\Support\Decorator;

/**
 * Class PagePresenter
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 * @package       Anomaly\PagesModule\Page
 */
class PagePresenter extends EntryPresenter
{

    /**
     * The decorated object.
     * This is for IDE hinting.
     *
     * @var PageInterface
     */
    protected $object;

    /**
     * Create a new PagePresenter instance.
     *
     * @param mixed $object
     */
    public function __construct($object)
    {
        $this->object = $object;
    }

    /**
     * Catch calls to fields on
     * the page's related entry.
     *
     * @param string $key
     * @return mixed
     */
    public function __get($key)
    {
        $entry = $this->object->getEntry();

        if ($entry->hasField($key)) {
            return (New Decorator())->decorate($entry)->{$key};
        }

        return parent::__get($key);
    }
}

<?php namespace Anomaly\PagesModule\Page;

use Anomaly\PagesModule\Page\Contract\PageInterface;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
use Anomaly\Streams\Platform\Support\Decorator;

/**
 * Class PagePresenter
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 * @package       Anomaly\PagesModule\Page
 */
class PagePresenter extends EntryPresenter
{

    /**
     * The decorated object.
     * This is for IDE hinting.
     *
     * @var PageInterface
     */
    protected $object;

    /**
     * Create a new PagePresenter instance.
     *
     * @param mixed $object
     */
    public function __construct($object)
    {
        $this->object = $object;
    }

    /**
     * Catch calls to fields on
     * the page's related entry.
     *
     * @param string $key
     * @return mixed
     */
    public function __get($key)
    {
        $entry = $this->object->getEntry();

        if ($entry && $entry->hasField($key)) {
            return (New Decorator())->decorate($entry)->{$key};
        }

        return parent::__get($key);
    }
}

Fix issue where the presenter bombs if the entry is not set / exists.


<?php
/**
 * CacheTest.php.
 */

namespace Pagon;

class CacheTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var App
     */
    protected $app;

    public function setUp()
    {
        $this->app = new App(array(
            'cache' => array(
                'user' => array(
                    'type' => 'file',
                )
            )
        ));
    }

    public function testFactory()
    {
        $file = Cache::factory('file');

        $this->assertInstanceOf('Pagon\Cache\File', $file);
    }

    public function testFactoryNonExists()
    {
        $this->setExpectedException('InvalidArgumentException');
        $none = Cache::factory('none');
    }

    public function testDispense()
    {
        $user_cache = Cache::dispense('cache.user');

        $this->assertInstanceOf('Pagon\Cache\File', $user_cache);

        $try_new_cache = Cache::dispense('user');

        $this->assertEquals($try_new_cache, $user_cache);
    }

    public function testDispenseNonExists()
    {
        $this->setExpectedException('InvalidArgumentException');
        $user_cache = Cache::dispense('cache.user1');
    }
}

<?php
/**
 * CacheTest.php.
 */

namespace Pagon;

class CacheTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var App
     */
    protected $app;

    public function setUp()
    {
        $this->app = new App(array(
            'cache' => array(
                'user' => array(
                    'type' => 'file',
                )
            )
        ));
    }

    public function testFactory()
    {
        $file = Cache::factory('file');

        $this->assertInstanceOf('Pagon\Cache\File', $file);
    }

    public function testFactoryNonExists()
    {
        $this->setExpectedException('InvalidArgumentException');
        $none = Cache::factory('none');
    }

    public function testDispense()
    {
        $user_cache = Cache::dispense('cache.user');

        $this->assertInstanceOf('Pagon\Cache\File', $user_cache);

        $try_new_cache = Cache::dispense('cache.user');

        $this->assertEquals($try_new_cache, $user_cache);
    }

    public function testDispenseNonExists()
    {
        $this->setExpectedException('InvalidArgumentException');
        $user_cache = Cache::dispense('cache.user1');
    }
}

Fix testcase for Cache dispense

Fix testcase for Cache dispense


<?php

/**
 * @author Todd Burry <todd@vanillaforums.com>
 * @copyright 2009-2016 Vanilla Forums Inc.
 * @license LGPLv2
 */

/**
 * Contains tests for github issues.
 */
class IssueTest extends pQueryTestCase {
    /**
     * Test attributes with no quotes.
     *
     * @link https://github.com/tburry/pquery/issues/4
     */
    public function testAttrWithoutQuotes() {
        $html = 'Example';
        $dom = pQuery::parseStr($html);

        $this->assertSame('/index.php/example', $dom->query('a')->attr('href'));
    }
}

<?php

/**
 * @author Todd Burry <todd@vanillaforums.com>
 * @copyright 2009-2016 Vanilla Forums Inc.
 * @license LGPLv2
 */

/**
 * Contains tests for github issues.
 */
class IssueTest extends pQueryTestCase {
    /**
     * Test attributes with no quotes.
     *
     * @link https://github.com/tburry/pquery/issues/4
     */
    public function testAttrWithoutQuotes() {
        $html = 'Example';
        $dom = pQuery::parseStr($html);

        $this->assertSame('/index.php/example', $dom->query('a')->attr('href'));
    }

    /**
     * Make sure that the {@link pQuery} class is still {@link Countable}.
     *
     * @link https://github.com/tburry/pquery/issues/8
     */
    public function testStillCountable() {
        $html = 'Is this what you want?';
        $dom = pQuery::parseStr($html);

        $pq = $dom->query('b');

        $this->assertTrue($pq instanceof \pQuery\IQuery);
        $this->assertTrue($pq instanceof \Countable);
        $count = count($pq);
        $this->assertSame(2, $count);
    }
}

Add a Countable unit test for pQuery

Add a Countable unit test for pQuery

Just in case I don’t know PHP.


        @if (Auth::guest())

{{ trans('backpack::base.login') }}

{{ trans('backpack::base.register') }}

        @else

 {{ trans('backpack::base.logout') }}

        @endif

        @if (Auth::guest())

{{ trans('backpack::base.login') }}

            @if (config('backpack::base.registration_open'))

{{ trans('backpack::base.register') }}

            @endif
        @else

 {{ trans('backpack::base.logout') }}

        @endif

Hide registration button if registration closed.


<?php

namespace CascadeEnergy\DistributedOperations\Elasticsearch;

use CascadeEnergy\DistributedOperations\Operation;
use Elasticsearch\Helper\Iterators\SearchHitIterator;

class ProviderIterator implements \Iterator
{
    /** @var SearchHitIterator */
    private $hitIterator;

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

    public function current()
    {
        $hit = $this->hitIterator->current();
        $source = $hit['source'];

        $operation = new Operation($source['batchId'], $hit['_type'], $source['options']);
        $operation->setState($source['state']);
        $operation->setDisposition($source['disposition']);

        return $operation;
    }

    public function next()
    {
        $this->hitIterator->next();
    }

    public function key()
    {
        return $this->hitIterator->key();
    }

    public function valid()
    {
        return $this->hitIterator->valid();
    }

    public function rewind()
    {
        $this->hitIterator->rewind();
    }
}

<?php

namespace CascadeEnergy\DistributedOperations\Elasticsearch;

use CascadeEnergy\DistributedOperations\Operation;
use Elasticsearch\Helper\Iterators\SearchHitIterator;

class ProviderIterator implements \Iterator
{
    /** @var SearchHitIterator */
    private $hitIterator;

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

    public function current()
    {
        $hit = $this->hitIterator->current();
        $source = $hit['_source'];

        $operation = new Operation($source['batchId'], $hit['_type'], $source['options']);
        $operation->setState($source['state']);
        $operation->setDisposition($source['disposition']);

        return $operation;
    }

    public function next()
    {
        $this->hitIterator->next();
    }

    public function key()
    {
        return $this->hitIterator->key();
    }

    public function valid()
    {
        return $this->hitIterator->valid();
    }

    public function rewind()
    {
        $this->hitIterator->rewind();
    }
}

Fix typo in provider iterator relating to source document from ES


<?php namespace Sprockets;

use SplFileInfo;
use Sprockets\Exception\AssetNotFoundException;

class Finder {
	protected $loadPaths;

	protected $typeExtensions = array(
		'stylesheet' => '.css',
		'javascript' => '.js'
	);

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

	public function find($name, $type = null)
	{
		if ($type && !with(new SplFileInfo($name))->getExtension())
		{
			$name.= $this->typeExtensions[$type];
		}

		foreach ($this->loadPaths as $loadPath)
		{
			$path = $loadPath . "/$name*";

			$files = glob($path);

			if (count($files) > 0)
			{
				$file = new SplFileInfo($files[0]);

				return $file->getRealPath();
			}
		}

		throw new AssetNotFoundException($name);
	}

	public function all()
	{
		$finder = \Symfony\Component\Finder\Finder::create();
		$files = iterator_to_array($finder->files()->in($this->loadPaths));

		return array_values($files);
	}

	public function __invoke($name)
	{
		return $this->find($name);
	}
}

<?php namespace Sprockets;

use SplFileInfo;
use Sprockets\Exception\AssetNotFoundException;

class Finder {
	protected $loadPaths;

	protected $typeExtensions = array(
		'stylesheet' => '.css',
		'javascript' => '.js'
	);

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

	public function find($name, $type = null)
	{
		if ($type && !with(new SplFileInfo($name))->getExtension())
		{
			$name.= $this->typeExtensions[$type];
		}

		foreach ($this->loadPaths as $loadPath)
		{
			$path = $loadPath . (with(new SplFileInfo($name))->getExtension() ? "/$name*" : "/$name.*");

			$files = glob($path);

			if (count($files) > 0)
			{
				$file = new SplFileInfo($files[0]);

				return $file->getRealPath();
			}
		}

		throw new AssetNotFoundException($name);
	}

	public function all()
	{
		$finder = \Symfony\Component\Finder\Finder::create();
		$files = iterator_to_array($finder->files()->in($this->loadPaths));

		return array_values($files);
	}

	public function __invoke($name)
	{
		return $this->find($name);
	}
}

Fix the finder more accurate when requesting a file without adding an extension

Fixes #3.


<?php include 'templates/header.php'; ?>

			User Options

			Modify your options to your preferences.

				Email:

			<?php echo $_SESSION['user']; ?>

		<?php include 'templates/color-select.html'; ?>

		<?php include 'templates/sections.html'; ?>

		<?php include 'templates/password.php'; ?>

<?php echo ''; // use this to echo the session user ID for the JS to use ?>

<?php include 'templates/footer.html'; ?>

Add script to fix mobile menu JS not functioning.


<?php

# Let Composer autoload Volcano
require 'vendor/autoload.php';

# Require our App to start up
require_once 'app.php';

<?php

# Let Composer autoload
require 'vendor/autoload.php';

# Require our App to start up
require_once 'app.php';

Fix comment for Composer autoloading

Fix comment for Composer autoloading


<?php

require_once 'Doctrine/Common/ClassLoader.php';

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

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

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

<?php

require_once 'Doctrine/Common/ClassLoader.php';

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

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

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

    require $configFile;

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

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

[2.0] Fix for CLI Configuration and PEAR installer

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


<?php

declare (strict_types = 1);

namespace Mihaeu\PhpDependencies;

class PhpFileFinder
{
    public function find(\SplFileInfo $file) : PhpFileCollection
    {
        return $file->isDir()
            ? $this->findInDir($file)
            : new PhpFileCollection();
    }

    private function findInDir(\SplFileInfo $dir) : PhpFileCollection
    {
        $collection = new PhpFileCollection();
        $regexIterator = new \RegexIterator(
            new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($dir->getPathname())
            ), '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH
        );
        foreach ($regexIterator as $fileName) {
            $collection->add(new PhpFile(new \SplFileInfo($fileName[0])));
        }

        return $collection;
    }
}

<?php

declare (strict_types = 1);

namespace Mihaeu\PhpDependencies;

class PhpFileFinder
{
    public function find(\SplFileInfo $file) : PhpFileCollection
    {
        return $file->isDir()
            ? $this->findInDir($file)
            : new PhpFileCollection();
    }

    private function findInDir(\SplFileInfo $dir) : PhpFileCollection
    {
        $collection = new PhpFileCollection();
        $regexIterator = new \RegexIterator(
            new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($dir->getPathname())
            ), '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH
        );
        foreach ($regexIterator as $fileName) {
            $collection = $collection->add(new PhpFile(new \SplFileInfo($fileName[0])));
        }

        return $collection;
    }
}

Fix bug where immutable collection was treated like mutable


<?php
namespace Wizard;

use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;

class Module implements
    ConfigProviderInterface,
    AutoloaderProviderInterface
{
    public function getConfig()
    {
        return include __DIR__ . '/../../config/module.config.php';
    }

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

<?php
namespace Wizard;

use Wizard\Service\WizardInitializer;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;

class Module implements
    ConfigProviderInterface,
    AutoloaderProviderInterface
{
    public function getConfig()
    {
        return include __DIR__ . '/../../config/module.config.php';
    }

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

    public function getServiceConfig()
    {
        return array(
            'initializers' => array(
                'wizard' => new WizardInitializer(),
            ),
        );
    }
}

Add wizard initializer in service manager


<?php

// Adds the Serializer object type so serializer objects
// can be found in conventional places
App::build(array(
	'Serializer' => array('%s' . 'Serializer' . DS),
	'Serializer' => array('%s' . 'Plugin' . DS . 'Serializers' . DS . 'Serializer' . DS),
), App::REGISTER);

// Ensure we loaded the SerializersErrors Plugin
CakePlugin::load('SerializersErrors', array('bootstrap' => true));

// Load CakePHP Serializers Exceptions
App::import('Lib/Error', 'Serializers.StandardJsonApiExceptions');

// Load the EmberDataError Class
App::uses('EmberDataError', 'Serializers.Error');

Drop loading a non-existent EmberDataError


<?php

namespace Studio\Console;

use Studio\Creator;
use Studio\Package;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CreateCommand extends Command
{

    protected $creator;

    public function __construct(Creator $creator)
    {
        parent::__construct();

        $this->creator = $creator;
    }

    protected function configure()
    {
        $this
            ->setName('create')
            ->setDescription('Create a new package skeleton')
            ->addArgument(
                'package',
                InputArgument::REQUIRED,
                'The name of the package to create'
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $directory = $this->creator->create($this->makePackage($input));

        $output->writeln("<info>Package directory $directory created.</info>");
    }

    protected function makePackage(InputInterface $input)
    {
        $name = $input->getArgument('package');

        if (! str_contains($name, '/')) {
            throw new \InvalidArgumentException('Invalid package name');
        }

        list($vendor, $package) = explode('/', $name, 2);
        return new Package($vendor, $package);
    }
}

<?php

namespace Studio\Console;

use Studio\Config\Config;
use Studio\Creator;
use Studio\Package;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CreateCommand extends Command
{

    protected $config;

    protected $creator;

    public function __construct(Config $config, Creator $creator)
    {
        parent::__construct();

        $this->config = $config;
        $this->creator = $creator;
    }

    protected function configure()
    {
        $this
            ->setName('create')
            ->setDescription('Create a new package skeleton')
            ->addArgument(
                'package',
                InputArgument::REQUIRED,
                'The name of the package to create'
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $package = $this->makePackage($input);
        $directory = $this->creator->create($package);
        $this->config->addPackage($package);

        $output->writeln("<info>Package directory $directory created.</info>");
    }

    protected function makePackage(InputInterface $input)
    {
        $name = $input->getArgument('package');

        if (! str_contains($name, '/')) {
            throw new \InvalidArgumentException('Invalid package name');
        }

        list($vendor, $package) = explode('/', $name, 2);
        return new Package($vendor, $package);
    }
}

Add newly created packages to config.

Add newly created packages to config.


<?php
namespace Sandhje\Spanner\Filesystem;

/**
 * Filesystem wrapper
 *
 * @author Sandhje
 *
 */
class Filesystem
{
    /**
     * is_file wrapper
     *
     * @param string $filename
     */
    public function is_file($filename)
    {
        return is_file($filename);
    }

    /**
     * is_dir wrapper
     *
     * @param string $dir
     */
    public function is_dir($directory)
    {
        return is_dir($directory);
    }

    /**
     * is_readable wrapper
     *
     * @param string $filename
     * @return boolean
     */
    public function is_readable($filename)
    {
        return is_readable($filename);
    }

    /**
     * pathinfo wrapper
     *
     * @param string $path
     * @param int $options
     * @return mixed
     */
    public function pathinfo($path, $options = PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME)
    {
        return pathinfo($path, $options);
    }

    /**
     * Load file from filesystem
     *
     * @param string $filename
     * @return string
     */
    public function load($filename)
    {
        $ext = pathinfo($filename, PATHINFO_EXTENSION);

        if($ext === "php") {
            return (include $filename);
        } else {
            return file_get_contents($filename);
        }

    }
}

?>

<?php
namespace Sandhje\Spanner\Filesystem;

/**
 * Filesystem wrapper
 *
 * @author Sandhje
 *
 */
class Filesystem
{
    /**
     * Equals PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME
     *
     * @var int
     */
    const PATHINFO_ALL = 15;

    /**
     * is_file wrapper
     *
     * @param string $filename
     */
    public function is_file($filename)
    {
        return is_file($filename);
    }

    /**
     * is_dir wrapper
     *
     * @param string $dir
     */
    public function is_dir($directory)
    {
        return is_dir($directory);
    }

    /**
     * is_readable wrapper
     *
     * @param string $filename
     * @return boolean
     */
    public function is_readable($filename)
    {
        return is_readable($filename);
    }

    /**
     * pathinfo wrapper
     *
     * @param string $path
     * @param int $options
     * @return mixed
     */
    public function pathinfo($path, $options = self::PATHINFO_ALL)
    {
        return pathinfo($path, $options);
    }

    /**
     * Load file from filesystem
     *
     * @param string $filename
     * @return string
     */
    public function load($filename)
    {
        $ext = pathinfo($filename, PATHINFO_EXTENSION);

        if($ext === "php") {
            return (include $filename);
        } else {
            return file_get_contents($filename);
        }

    }
}

?>

Fix php5.5 bug with unsuported boolean or in argument default


<?php

declare(strict_types=1);

namespace BEAR\QueryRepository;

use BEAR\Resource\NamedParameter;
use BEAR\Resource\NamedParameterInterface;
use Ray\Di\AbstractModule;
use Ray\Di\Scope;
use Ray\PsrCacheModule\Psr6ArrayModule;

final class QueryRepositoryModule extends AbstractModule
{
    /**
     * {@inheritdoc}
     */
    protected function configure(): void
    {
        $this->install(new Psr6ArrayModule());
        // core
        $this->bind(QueryRepositoryInterface::class)->to(QueryRepository::class)->in(Scope::SINGLETON);
        $this->bind(CacheDependencyInterface::class)->to(CacheDependency::class);
        $this->bind(EtagSetterInterface::class)->to(EtagSetter::class)->in(Scope::SINGLETON);
        $this->bind(NamedParameterInterface::class)->to(NamedParameter::class)->in(Scope::SINGLETON);
        $this->bind(ResourceStorageInterface::class)->to(ResourceStorage::class);
        $this->bind(MatchQueryInterface::class)->to(MatchQuery::class)->in(Scope::SINGLETON);
        $this->bind(UriTag::class)->in(Scope::SINGLETON);
        // #[Cacheable]
        $this->install(new CacheableModule());
        // #[CacheableResponse]
        $this->install(new DonutCacheModule());
    }
}

<?php

declare(strict_types=1);

namespace BEAR\QueryRepository;

use BEAR\Resource\NamedParameter;
use BEAR\Resource\NamedParameterInterface;
use Psr\Cache\CacheItemPoolInterface;
use Ray\Di\AbstractModule;
use Ray\Di\Scope;
use Ray\PsrCacheModule\Annotation\Shared;
use Symfony\Component\Cache\Adapter\NullAdapter;

final class QueryRepositoryModule extends AbstractModule
{
    /**
     * {@inheritdoc}
     */
    protected function configure(): void
    {
        // Null cache default
        $this->bind(CacheItemPoolInterface::class)->annotatedWith(Shared::class)->to(NullAdapter::class)->in(Scope::SINGLETON);
        // core
        $this->bind(QueryRepositoryInterface::class)->to(QueryRepository::class)->in(Scope::SINGLETON);
        $this->bind(CacheDependencyInterface::class)->to(CacheDependency::class);
        $this->bind(EtagSetterInterface::class)->to(EtagSetter::class)->in(Scope::SINGLETON);
        $this->bind(NamedParameterInterface::class)->to(NamedParameter::class)->in(Scope::SINGLETON);
        $this->bind(ResourceStorageInterface::class)->to(ResourceStorage::class);
        $this->bind(MatchQueryInterface::class)->to(MatchQuery::class)->in(Scope::SINGLETON);
        $this->bind(UriTag::class)->in(Scope::SINGLETON);
        // #[Cacheable]
        $this->install(new CacheableModule());
        // #[CacheableResponse]
        $this->install(new DonutCacheModule());
    }
}

Change NullAdapter from ArrayAdapter default


<?php
/**
 * PHPUnit bootstrap file
 *
 * @package WP-Auth0
 */

ini_set( 'error_log', '/dev/null' );
echo 'PHP version: ' . phpversion() . "\n";

$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
	$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
	echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
	exit( 1 );
}

// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';

/**
 * Manually load the plugin being tested.
 */
function _manually_load_plugin() {
	require dirname( dirname( __FILE__ ) ) . '/WP_Auth0.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

// Start up the WP testing environment.
if ( ! file_exists( $_tests_dir . '/includes/bootstrap.php' ) ) {
	echo "Could not find $_tests_dir/includes/bootstrap.php" . PHP_EOL;
	exit( 1 );
}

require $_tests_dir . '/includes/bootstrap.php';
require dirname( __FILE__ ) . '/../vendor/autoload.php';

<?php
/**
 * PHPUnit bootstrap file
 *
 * @package WP-Auth0
 */

ini_set( 'error_log', '/dev/null' );

$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
	$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
	echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
	exit( 1 );
}

// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';

/**
 * Manually load the plugin being tested.
 */
function _manually_load_plugin() {
	require dirname( dirname( __FILE__ ) ) . '/WP_Auth0.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

// Start up the WP testing environment.
if ( ! file_exists( $_tests_dir . '/includes/bootstrap.php' ) ) {
	echo "Could not find $_tests_dir/includes/bootstrap.php" . PHP_EOL;
	exit( 1 );
}

require $_tests_dir . '/includes/bootstrap.php';
require dirname( __FILE__ ) . '/../vendor/autoload.php';

Stop outputting PHP version during testing


<?
require_once('php/classes/member.php');

$profileEdited = new Member($_GET['member']);
if (!$currentUser->isAdmin() || !$profileEdited->exists()) {
  $profileEdited = $currentUser;
}

?>

Edit Profile Picture: <?=$profileEdited->rcsid()?>

This picture is displayed publicly on the "About Us" page:

    <img src="<?=$profileEdited->photoURL()?>" alt="<?=$profileEdited->fullName()?>">

The new image must be a JPEG (*.jpg) file smaller than 1 MB.

    <form enctype="multipart/form-data" action="post.php" method="post">
      <input type="hidden" name="rcsid" value="<?=$profileEdited->rcsid()?>">
      <input type="hidden" name="MAX_FILE_SIZE" value="1048576">

          <input name="new_profile_photo" type="file">
          <button type="submit" name="action"
            value="profile_photo_edit">Upload</button>

    </form>

<?
require_once('php/classes/member.php');

$profileEdited = new Member($_GET['member']);
if (!$currentUser->isAdmin() || !$profileEdited->exists()) {
  $profileEdited = $currentUser;
}

?>

Edit Profile Picture: <?=$profileEdited->rcsid()?>

This picture is displayed publicly on the "About Us" page:

    <img class="editing" src="<?=$profileEdited->photoURL()?>" alt="<?=$profileEdited->fullName()?>">

The new image must be a JPEG (*.jpg) file smaller than 1 MB.

    <form enctype="multipart/form-data" action="post.php" method="post">
      <input type="hidden" name="rcsid" value="<?=$profileEdited->rcsid()?>">
      <input type="hidden" name="MAX_FILE_SIZE" value="1048576">

          <input name="new_profile_photo" type="file">
          <button type="submit" name="action"
            value="profile_photo_edit">Upload</button>

    </form>

Fix height of photo in profile picture edit page


<?php

namespace Helge\Tests;

use Helge\Client\SimpleWhoisClient;

class SimpleWhoisClientTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Helge\Client\WhoisClientInterface
     */
    protected $whoisClient;

    public function setup()
    {

        require 'vendor/autoload.php';

        $this->whoisClient = new SimpleWhoisClient();

    }

    // TODO(22 okt 2015) ~ Helge: Write tests

}

<?php

namespace Helge\Tests;

use Helge\Client\SimpleWhoisClient;

class SimpleWhoisClientTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Helge\Client\WhoisClientInterface
     */
    protected $whoisClient;

    public function setup()
    {
        $this->whoisClient = new SimpleWhoisClient();
    }

    public function testGetAndSetServer()
    {
        $client = new SimpleWhoisClient();
        $client->setServer('whois.verisign-grs.com');
        $this->assertEquals('whois.verisign-grs.com', $client->getServer());
    }

    public function testDefaultPort()
    {
        $client = new SimpleWhoisClient();
        $this->assertEquals(43, $client->getPort());
    }

    public function testGetAndSetPort()
    {
        $client = new SimpleWhoisClient();
        $client->setPort(443);
        $this->assertEquals(443, $client->getPort());
    }

    public function testQueryValidWhoisServer()
    {
        $client = new SimpleWhoisClient('whois.verisign-grs.com');
        $this->assertTrue(
            $client->query('example.com'),
            'Querying a valid Whois Server should return true'
        );

        $this->assertNotEmpty(
            $client->getResponse(),
            'After querying a valid Whois Server, response data should be available'
        );
    }

    public function testQueryInvalidWhoisServer()
    {
        $client = new SimpleWhoisClient('localhost'); // We are assuming that the local machine doesnt have a whois server
        $this->assertFalse(
            $client->query('example.com'),
            'Querying a Whois server that cannot be connected to should return false'
        );
    }

}

Add test coverage of SimpleWhoisClient class


<?php
/*
 *  $Id$
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\DBAL\Driver\PDOSqlsrv;

/**
 * Sqlsrv Connection implementation.
 *
 * @since 2.0
 */
class Connection extends \PDO implements \Doctrine\DBAL\Driver\Connection
{
    /**
     * @override
     */
    public function quote($value, $type=\PDO::PARAM_STR)
    {
        $val = parent::quote($value, $type);

		// Fix for a driver version terminating all values with null byte
		if (strpos($val, "\0") !== false) {
			$val = substr($val, 0, -1);
		}

		return $val;
    }
}

<?php
/*
 *  $Id$
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\DBAL\Driver\PDOSqlsrv;

/**
 * Sqlsrv Connection implementation.
 *
 * @since 2.0
 */
class Connection extends \Doctrine\DBAL\Driver\PDOConnection implements \Doctrine\DBAL\Driver\Connection
{
    /**
     * @override
     */
    public function quote($value, $type=\PDO::PARAM_STR)
    {
        $val = parent::quote($value, $type);

		// Fix for a driver version terminating all values with null byte
		if (strpos($val, "\0") !== false) {
			$val = substr($val, 0, -1);
		}

		return $val;
    }
}

Correct Sqlsrv connection class definition


<?php

namespace Ehann\RediSearch\Fields;

class TextField extends AbstractField
{
    protected $weight = 1.0;

    public function getType(): string
    {
        return 'TEXT';
    }

    public function getWeight(): float
    {
        return $this->weight;
    }

    public function setWeight(float $weight)
    {
        $this->weight = $weight;
        return $this;
    }

    public function make(): FieldInterface
    {
        return (new TextField($this->getName()))->getValue();
    }

    public function getTypeDefinition(): array
    {
        $properties = parent::getTypeDefinition();
        $properties[] = 'WEIGHT';
        $properties[] = $this->getWeight();
        return $properties;
    }
}

<?php

namespace Ehann\RediSearch\Fields;

class TextField extends AbstractField
{
    protected $weight = 1.0;

    public function getType(): string
    {
        return 'TEXT';
    }

    public function getWeight(): float
    {
        return $this->weight;
    }

    public function setWeight(float $weight)
    {
        $this->weight = $weight;
        return $this;
    }

    public function getTypeDefinition(): array
    {
        $properties = parent::getTypeDefinition();
        $properties[] = 'WEIGHT';
        $properties[] = $this->getWeight();
        return $properties;
    }
}

Remove nonfunctional and unnecessary text field factory method


<?php
    class UnitTest {
        public $assertCount = 0;
        public $passCount = 0;

        public function assertTrue( $condition, $description = '' ) {
            ++$this->assertCount;

            if ( !$condition ) {
                throw new UnitTestFailedException( $description );
            }

            ++$this->passCount;
        }
        public function assertEquals( $expected, $actual, $description = '' ) {
            if ( $description != '' ) {
                $description .= '. ';
            }
            $description .= "Expected '$expected', found '$actual'.";
            $this->assertTrue( $expected === $actual, $description );
        }
        public function setUp() {
            $tables = dbListTables();
            foreach ( $tables as $table ) {
                db( 'TRUNCATE TABLE ' . $table );
            }
        }
    }

    class UnitTestFailedException extends Exception {}
?>

<?php
    abstract class UnitTest {
        public $assertCount = 0;
        public $passCount = 0;

        public function assertTrue( $condition, $description = '' ) {
            ++$this->assertCount;

            if ( !$condition ) {
                throw new UnitTestFailedException( $description );
            }

            ++$this->passCount;
        }
        public function assertEquals( $expected, $actual, $description = '' ) {
            if ( $description != '' ) {
                $description .= '. ';
            }
            $description .= "Expected '$expected', found '$actual'.";
            $this->assertTrue( $expected === $actual, $description );
        }
        public function setUp() {
            $tables = dbListTables();
            foreach ( $tables as $table ) {
                db( 'TRUNCATE TABLE ' . $table );
            }
        }
    }

    class UnitTestFailedException extends Exception {}
?>

Make unit test class abstract

Make unit test class abstract


<?php

/**
 * Created by ARTWIN.PRO
 *
 * Date: 26.10.16
 */
namespace Artwinpro\LaravelSearch;

use Input;

trait SearchTrait
{

    public function scopeSearch($query)
    {
        foreach (Input::all() as $key => $value) {
            if (in_array($key, $this->searchable)) {
                $query = $query->where($key, 'LIKE', '%' . $value . '%');
            }
        }

        return $query;

    }
}

<?php

/**
 * Created by ARTWIN.PRO
 *
 * Date: 26.10.16
 */
namespace Artwinpro\LaravelSearch;

use Illuminate\Support\Facades\Input;

trait SearchTrait
{

    public function scopeSearch($query)
    {
        foreach (Input::all() as $key => $value) {
            if (in_array($key, $this->searchable)) {
                $query = $query->where($key, 'LIKE', '%' . $value . '%');
            }
        }

        return $query;

    }
}

Fix input bug in laravel 5.3v

Fix input bug in laravel 5.3v


<?php
declare(strict_types=1);

namespace Onion\Framework\Hydrator;

trait PropertyHydrator
{
    /**
     * @inheritdoc
     */
    public function hydrate(array $data)
    {
        $target = clone $this;
        foreach ($data as $name => $value) {
            $property = str_replace('_', '', lcfirst(ucwords($name, '_')));
            if (property_exists($target, $property)) {
                $target->$property = $value;
            }
        }

        return $target;
    }

    /**
     * @inheritdoc
     */
    public function extract(array $keys = []): array
    {
        $data = [];
        if ($keys === []) {
            $reflection = new \ReflectionObject($this);
            foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $name => $value) {
                $data[strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $name))] = $value;
            }

            return $data;
        }

        foreach ($keys as $name => $value) {
            $data[strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $name))] = $value;
        }

        return $data;
    }
}

<?php
declare(strict_types=1);

namespace Onion\Framework\Hydrator;

trait PropertyHydrator
{
    /**
     * @inheritdoc
     */
    public function hydrate(array $data)
    {
        $target = clone $this;
        foreach ($data as $name => $value) {
            $property = str_replace('_', '', lcfirst(ucwords($name, '_')));
            if (property_exists($target, $property)) {
                $target->$property = $value;
            }
        }

        return $target;
    }

    /**
     * @inheritdoc
     */
    public function extract(array $keys = []): array
    {
        $data = [];
        if ($keys === []) {
            $reflection = new \ReflectionObject($this);
            foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                $data[strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $property->getName()))] =
                    $property->getValue($this);
            }

            return $data;
        }

        foreach ($keys as $name => $value) {
            $data[strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $name))] = $value;
        }

        return $data;
    }
}

Fix wrong usage of \ReflectionProperty on extraction


<?php
/**
 * Phossa Project
 *
 * PHP version 5.4
 *
 * @category  Library
 * @package   Phossa2\Config
 * @copyright Copyright (c) 2016 phossa.com
 * @license   http://mit-license.org/ MIT License
 * @link      http://www.phossa.com/
 */
/*# declare(strict_types=1); */

namespace Phossa2\Config\Traits;

use Phossa2\Config\Interfaces\WritableInterface;

/**
 * Implementation of WritableInterface
 *
 * @package Phossa2\Config
 * @author  Hong Zhang <phossa@126.com>
 * @see     WritableInterface
 * @version 2.0.0
 * @since   2.0.0 added
 */
trait WritableTrait
{
    /**
     * @var    false|mixed
     * @access protected
     */
    protected $writable = false;

    /**
     * {@inheritDoc}
     */
    public function isWritable()/*# : bool */
    {
        return false !== $this->writable;
    }

    /**
     * {@inheritDoc}
     */
    public function setWritable($writable)
    {
        $this->writable = $writable;
        return $this;
    }

    // from WritableInterface
    abstract public function set(/*# string */ $id, $value);
}

<?php
/**
 * Phossa Project
 *
 * PHP version 5.4
 *
 * @category  Library
 * @package   Phossa2\Config
 * @copyright Copyright (c) 2016 phossa.com
 * @license   http://mit-license.org/ MIT License
 * @link      http://www.phossa.com/
 */
/*# declare(strict_types=1); */

namespace Phossa2\Config\Traits;

use Phossa2\Config\Interfaces\WritableInterface;

/**
 * Implementation of WritableInterface
 *
 * @package Phossa2\Config
 * @author  Hong Zhang <phossa@126.com>
 * @see     WritableInterface
 * @version 2.0.0
 * @since   2.0.0 added
 */
trait WritableTrait
{
    /**
     * @var    false|mixed
     * @access protected
     */
    protected $writable = true;

    /**
     * {@inheritDoc}
     */
    public function isWritable()/*# : bool */
    {
        return false !== $this->writable;
    }

    /**
     * {@inheritDoc}
     */
    public function setWritable($writable)
    {
        $this->writable = $writable;
        return $this;
    }

    // from WritableInterface
    abstract public function set(/*# string */ $id, $value);
}

Make config default to writable

Make config default to writable


<?php

/**
 * This file is part of the MessageX PHP SDK package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace MessageX\Service\Email\ValueObject\Body;

use JMS\Serializer\Annotation as Serializer;

/**
 * Class Body
 * @package MessageX\Service\Email\ValueObject\Body
 * @author Silvio Marijic <silvio.marijic@smsglobal.com>
 */
final class Body
{
    /**
     * @var string Content type of the email.
     * @Serializer\Type("string")
     */
    private $mime;

    /**
     * @var string Email content.
     * @Serializer\Type("string")
     */
    private $content;

    /**
     * Body constructor.
     * @param string $mime Content type of the email.
     * @param string $content Email content.
     */
    public function __construct($mime, $content)
    {
        $this->mime     = new MimeType($mime);
        $this->content  = $content;
    }

    /**
     * @return string Content type of the email.
     */
    public function getMime()
    {
        return $this->mime;
    }

    /**
     * @return string Email content.
     */
    public function getContent()
    {
        return $this->content;
    }
}

<?php

/**
 * This file is part of the MessageX PHP SDK package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace MessageX\Service\Email\ValueObject\Body;

use JMS\Serializer\Annotation as Serializer;

/**
 * Class Body
 * @package MessageX\Service\Email\ValueObject\Body
 * @author Silvio Marijic <silvio.marijic@smsglobal.com>
 */
final class Body
{
    /**
     * @var string Content type of the email.
     * @Serializer\Type("string")
     */
    private $mime;

    /**
     * @var string Email content.
     * @Serializer\Type("string")
     */
    private $content;

    /**
     * Body constructor.
     * @param string $mime Content type of the email.
     * @param string $content Email content.
     */
    public function __construct($mime, $content)
    {
        $this->mime     = new MimeType($mime);
        $this->content  = $content;
    }

    /**
     * @return string Content type of the email.
     */
    public function getMime()
    {
        return (string) $this->mime;
    }

    /**
     * @return string Email content.
     */
    public function getContent()
    {
        return $this->content;
    }
}

Add type conversion for mime

Add type conversion for mime


<?php

namespace Bridge\HttpApi\Worker;

use Bridge\HttpApi\Serializer\PathDenormalizer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Serializer;
use Transfer\Worker\WorkerInterface;

class SerializationWorker implements WorkerInterface
{
    /**
     * @var array
     */
    private $deserialization;

    /**
     * @var array
     */
    private $source;

    /**
     * @param array $deserialization
     * @param array $source
     */
    public function __construct($deserialization, $source)
    {
        $this->deserialization = $deserialization;
        $this->source = $source;
    }

    /**
     * {@inheritdoc}
     */
    public function handle($object)
    {
        $normalizers = array();

        $normalizers[] = new GetSetMethodNormalizer();

        if (isset($this->deserialization['path'])) {
            $normalizers[] = new PathDenormalizer($this->deserialization['path']);
        }

        $normalizers[] = new ArrayDenormalizer();

        $encoders = array(new JsonEncoder());

        $serializer = new Serializer($normalizers, $encoders);

        $object = $serializer->deserialize(
            $object,
            $this->deserialization['type'],
            $this->source['format']
        );

        return $object;
    }
}

<?php

namespace Bridge\HttpApi\Worker;

use Bridge\HttpApi\Serializer\PathDenormalizer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Serializer;
use Transfer\Worker\WorkerInterface;

class SerializationWorker implements WorkerInterface
{
    /**
     * @var array
     */
    private $deserialization;

    /**
     * @var array
     */
    private $source;

    /**
     * @param array $deserialization
     * @param array $source
     */
    public function __construct($deserialization, $source)
    {
        $this->deserialization = $deserialization;
        $this->source = $source;
    }

    /**
     * {@inheritdoc}
     */
    public function handle($object)
    {
        if (isset($this->deserialization['serializer'])) {
            $serializer = $this->deserialization['serializer'];
        } else {
            $serializer = $this->getDefaultSerializer();
        }

        $object = $serializer->deserialize(
            $object,
            $this->deserialization['type'],
            $this->source['format']
        );

        return $object;
    }

    private function getDefaultSerializer()
    {
        $normalizers = array();

        $normalizers[] = new GetSetMethodNormalizer();

        if (isset($this->deserialization['path'])) {
            $normalizers[] = new PathDenormalizer($this->deserialization['path']);
        }

        $normalizers[] = new ArrayDenormalizer();

        $encoders = array(new JsonEncoder());

        $serializer = new Serializer($normalizers, $encoders);

        return $serializer;
    }
}

Add support for custom serializer

Add support for custom serializer