<?php
/**
 * Humbug
 *
 * @category   Humbug
 * @package    Humbug
 * @copyright  Copyright (c) 2015 Pádraic Brady (http://blog.astrumfutura.com)
 * @license    https://github.com/padraic/humbug/blob/master/LICENSE New BSD License
 */

namespace Humbug\PhpSpec\Listener;

use Humbug\PhpSpec\Logger\JsonSpecMapLogger;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use PhpSpec\Event\ExampleEvent;
use PhpSpec\Event\SpecificationEvent;
use PhpSpec\Event\SuiteEvent;

class SpecMapperListener implements EventSubscriberInterface
{

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

    public static function getSubscribedEvents()
    {
        return [
            'afterSpecification' => ['afterSpecification', -10],
        ];
    }

    public function afterSpecification(SpecificationEvent $event)
    {
        $this->logger->logSpecification(
            $event->getSpecification()->getClassReflection()->getFileName(),
            $event->getTitle(),
            $event->getSpecification()->getClassReflection()->name
        );
    }

    public function afterSuite(SuiteEvent $event)
    {
        $this->logger->write();
    }
}

<?php
/**
 * Humbug
 *
 * @category   Humbug
 * @package    Humbug
 * @copyright  Copyright (c) 2015 Pádraic Brady (http://blog.astrumfutura.com)
 * @license    https://github.com/padraic/humbug/blob/master/LICENSE New BSD License
 */

namespace Humbug\PhpSpec\Listener;

use Humbug\PhpSpec\Logger\JsonSpecMapLogger;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use PhpSpec\Event\ExampleEvent;
use PhpSpec\Event\SpecificationEvent;
use PhpSpec\Event\SuiteEvent;

class SpecMapperListener implements EventSubscriberInterface
{

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

    public static function getSubscribedEvents()
    {
        return [
            'afterSpecification' => ['afterSpecification', -10],
            'afterSuite' => ['afterSuite', -10]
        ];
    }

    public function afterSpecification(SpecificationEvent $event)
    {
        $this->logger->logSpecification(
            $event->getSpecification()->getClassReflection()->getFileName(),
            $event->getTitle(),
            $event->getSpecification()->getClassReflection()->name
        );
    }

    public function afterSuite(SuiteEvent $event)
    {
        $this->logger->write();
    }
}

Add afterSuite event to specmaplistener

Add afterSuite event to specmaplistener


<?php
/**
 * ownCloud - oauth2
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Lukas Biermann
 * @copyright Lukas Biermann 2016
 */

namespace OCA\OAuth2\Controller;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;

class SettingsController extends Controller {

    private $clientMapper;

    public function __construct($AppName, IRequest $request, ClientMapper $mapper) {
        parent::__construct($AppName, $request);
        $this->clientMapper = $mapper;
    }

    /**
     * Adds a client.
     *
     * @return RedirectResponse Redirection to the settings page.
     *
     * @NoCSRFRequired
     *
     */
    public function addClient() {
        $clients = $this->clientMapper->findAll();
        echo var_dump($clients);
        echo $_POST["name"].$_POST["redirect_uri"];
        return new RedirectResponse('../settings/admin#oauth-2.0');
    }

}

<?php
/**
 * ownCloud - oauth2
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Lukas Biermann
 * @copyright Lukas Biermann 2016
 */

namespace OCA\OAuth2\Controller;
use OCA\OAuth2\Db\Client;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\IRequest;

class SettingsController extends Controller {

    private $clientMapper;
    private $userId;

    public function __construct($AppName, IRequest $request, ClientMapper $mapper, $UserId) {
        parent::__construct($AppName, $request);
        $this->clientMapper = $mapper;
        $this->userId = $UserId;
    }

    /**
     * Adds a client.
     *
     * @return RedirectResponse Redirection to the settings page.
     *
     * @NoCSRFRequired
     *
     */
    public function addClient() {
        $client = new Client();
        $client->setClientId('abc');
        $client->setName($_POST['name']);
        $client->setClientSecret('topSecret');
        $client->setRedirectUri($_POST['redirect_uri']);
        $client->setGrantTypes('access_code');
        $client->setScope('files');
        $client->setUserId($this->userId);

        $this->clientMapper->insert($client);

        return new RedirectResponse('../../settings/admin#oauth-2.0');
    }

}

Add dummy implementation of addClient()

Add dummy implementation of addClient()


<?php

namespace TimetablePusher\Http\Controllers;

use Illuminate\Http\Request;
use TimetablePusher\Http\Requests;
use TimetablePusher\Http\Controllers\Controller;

class TokenController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

<?php

namespace TimetablePusher\Http\Controllers;

use Auth;
use Illuminate\Http\Request;
use TimetablePusher\Http\Requests;
use TimetablePusher\Http\Controllers\Controller;
use TimetablePusher\TimetablePusher\Token;

class TokenController extends Controller
{
    /**
     * Update the specified resource in storage.
     * @return \Illuminate\Http\Response
     * @internal param Request $request
     * @internal param int $id
     */
    public function update()
    {
        // Generate new token
        $token = new Token();
        $apiToken = $token->generateUnique();

        $user = Auth::user();
        $user->api_token = $apiToken;
        $user->update();

        return redirect('dashboard')->with('success', 'Your API token has been regenerated.');
    }
}

Add token generation to controller

Add token generation to controller


<?PHP

/**
 *  A common interface for all value objects.
 *
 *
 *  @author      Adamo Crespi <hello@aerendir.me>
 *  @copyright   Copyright (c) 2015, Adamo Crespi
 *  @license     MIT License
 */
namespace SerendipityHQ\Component\ValueObjects\Common;

/**
 * Implements basic constructor for complex value objects.
 */
trait ComplexValueObjectTrait
{
    /** @var array Contains the data for which a property were not found */
    private $otherData = [];

    /**
     * Accepts an array containing the values to set in the object.
     *
     * @param array $values
     */
    public function __construct(array $values)
    {
        foreach ($values as $property => $value) {
            $setter = 'set' . ucfirst($property);
            $adder = 'add' . ucfirst($property);

            if (true === method_exists($this, $setter)) {
                $this->$setter($value);
                unset($values[$property]);
            }

            if (true === method_exists($this, $adder)) {
                $this->$adder($value);
                unset($values[$property]);
            }
        }

        // Add remaining value to $otherData
        $this->otherData = $values;
    }

    /**
     * Get other data if present, null instead.
     *
     * @return array|null
     */
    public function getOtherData()
    {
        return (true === empty($this->otherData)) ? null : $this->otherData;
    }
}

<?PHP

/**
 *  A common interface for all value objects.
 *
 *
 *  @author      Adamo Crespi <hello@aerendir.me>
 *  @copyright   Copyright (c) 2015, Adamo Crespi
 *  @license     MIT License
 */
namespace SerendipityHQ\Component\ValueObjects\Common;

/**
 * Implements basic constructor for complex value objects.
 */
trait ComplexValueObjectTrait
{
    /** @var array Contains the data for which a property were not found */
    private $otherData = [];

    /**
     * Accepts an array containing the values to set in the object.
     *
     * @param array $values
     */
    public function __construct(array $values)
    {
        foreach ($values as $property => $value) {
            $setter = 'set' . ucfirst($property);
            $adder = 'add' . ucfirst($property);

            if (true === method_exists($this, $setter)) {
                $this->$setter($value);
                unset($values[$property]);
            }

            if (true === method_exists($this, $adder)) {
                $this->$adder($value);
                unset($values[$property]);
            }
        }

        // Add remaining value to $otherData
        $this->otherData = $values;
    }

    /**
     * Get other data if present, null instead.
     *
     * @return array|null
     */
    public function getOtherData()
    {
        return (true === empty($this->otherData)) ? null : $this->otherData;
    }

    /**
     * Returns the built value object or null if no one is present.
     * @return mixed
     */
    public function getValueObject()
    {
        return $this->valueObject;
    }
}

Add a method to get the value objects built internally.


<?php

namespace Bolt\Provider;

use Bolt\Logger\Manager;
use Bolt\Logger\Handler\SystemHandler;
use Bolt\Logger\Handler\RecordChangeHandler;
use Monolog\Logger;
use Silex\Application;
use Silex\ServiceProviderInterface;

/**
 * Monolog provider for Bolt system logging entries
 *
 * @author Gawain Lynch <gawain.lynch@gmail.com>
 */
class LoggerServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        // System log
        $app['logger.system'] = $app->share(function ($app) {
            $log = new Logger('logger.system');

            $log->pushHandler(new SystemHandler($app));

            return $log;
        });

        // Changelog
        $app['logger.change'] = $app->share(function ($app) {
            $log = new Logger('logger.system');

            $log->pushHandler(new RecordChangeHandler($app));

            return $log;
        });

        // Manager
        $app['logger.manager'] = $app->share(function ($app) {
            $mgr = new Manager($app);

            return $mgr;
        });
    }

    public function boot(Application $app)
    {
    }
}

<?php

namespace Bolt\Provider;

use Bolt\Logger\Manager;
use Bolt\Logger\Handler\SystemHandler;
use Bolt\Logger\Handler\RecordChangeHandler;
use Monolog\Logger;
use Silex\Application;
use Silex\ServiceProviderInterface;

/**
 * Monolog provider for Bolt system logging entries
 *
 * @author Gawain Lynch <gawain.lynch@gmail.com>
 */
class LoggerServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        // System log
        $app['logger.system'] = $app->share(function ($app) {
            $log = new Logger('logger.system');

            $log->pushHandler(new SystemHandler($app));

            return $log;
        });

        // Changelog
        $app['logger.change'] = $app->share(function ($app) {
            $log = new Logger('logger.change');

            $log->pushHandler(new RecordChangeHandler($app));

            return $log;
        });

        // Manager
        $app['logger.manager'] = $app->share(function ($app) {
            $mgr = new Manager($app);

            return $mgr;
        });
    }

    public function boot(Application $app)
    {
    }
}

Use correct name on logger.change

Use correct name on logger.change


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

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

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

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

>>> $cc =>hax proc_get_status(ours[hax]);
}
?>

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

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

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

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

>>> $cc =>hax proc_get_status(hax $ours);
}
?>

Modify get-status option in file

Modify get-status option in file


<?php
namespace Gt\Dom;

use DOMNode;

/**
 * Represents an attribute on an Element object.
 *
 * In most DOM methods, you will probably directly retrieve the attribute as a
 * string (e.g., Element::getAttribute()), but certain functions (e.g.,
 * Element::getAttributeNode()) or means of iterating give Attr types.
 *
 * @property-read Element $ownerElement
 * @property-read Element $parentNode
 * @property-read Node|Element|null $firstChild
 * @property-read Node|Element|null $lastChild
 * @property-read Node|Element|null $previousSibling
 * @property-read Node|Element|null $nextSibling
 * @property-read Document $ownerDocument
 *
 * @method Element appendChild(DOMNode $newnode)
 * @method Element cloneNode(bool $deep = false)
 * @method Element insertBefore(DOMNode $newnode, DOMNode $refnode = null)
 * @method Element removeChild(DOMNode $oldnode)
 * @method Element replaceChild(DOMNode $newnode, DOMNode $oldnode)
 */
class Attr extends \DOMAttr {
	public function remove():self {
		return $this->ownerElement->removeAttributeNode($this);
	}
}

<?php
namespace Gt\Dom;

use DOMNode;

/**
 * Represents an attribute on an Element object.
 *
 * In most DOM methods, you will probably directly retrieve the attribute as a
 * string (e.g., Element::getAttribute()), but certain functions (e.g.,
 * Element::getAttributeNode()) or means of iterating give Attr types.
 *
 * @property-read Element $ownerElement
 * @property-read Element $parentNode
 * @property-read Node|Element|null $firstChild
 * @property-read Node|Element|null $lastChild
 * @property-read Node|Element|null $previousSibling
 * @property-read Node|Element|null $nextSibling
 * @property-read Document $ownerDocument
 *
 * @method Element appendChild(DOMNode $newnode)
 * @method Element cloneNode(bool $deep = false)
 * @method Element insertBefore(DOMNode $newnode, DOMNode $refnode = null)
 * @method Element removeChild(DOMNode $oldnode)
 * @method Element replaceChild(DOMNode $newnode, DOMNode $oldnode)
 */
class Attr extends \DOMAttr {
	public function remove():self {
		$this->ownerElement->removeAttributeNode($this);
		return $this;
	}
}

Correct return type for removal of attribute


<?php
namespace Kameli\Quickpay;

use InvalidArgumentException;

class Form
{
    const FORM_ACTION = 'https://payment.quickpay.net';

    /**
     * @var array
     */
    protected $parameters = [
        'version' => 'v10',
    ];

    /**
     * @var array
     */
    protected static $requiredParameters = [
        'version', 'merchant_id', 'agreement_id', 'order_id', 'amount', 'currency', 'continueurl', 'cancelurl',
    ];

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

    /**
     * @return string
     */
    public function action()
    {
        return static::FORM_ACTION;
    }

    /**
     * Render the form
     * @return string
     */
    public function render()
    {
        $missingParameters = array_diff(static::$requiredParameters, array_keys($this->parameters));

        if (! empty($missingParameters)) {
            $message = 'Missing arguments for Quickpay Form: ' . implode(', ', $missingParameters);
            throw new InvalidArgumentException($message);
        }

        $fields = [];
        foreach ($this->parameters as $parameter => $value) {
            $fields[] = sprintf('<input type="hidden" name="%s" value="%s">', $parameter, $value);
        }

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

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

<?php
namespace Kameli\Quickpay;

use InvalidArgumentException;

class Form
{
    const FORM_ACTION = 'https://payment.quickpay.net';

    /**
     * @var array
     */
    protected $parameters = [
        'version' => 'v10',
    ];

    /**
     * @var array
     */
    protected static $requiredParameters = [
        'version', 'merchant_id', 'agreement_id', 'order_id', 'amount', 'currency', 'continueurl', 'cancelurl',
    ];

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

    /**
     * @return string
     */
    public function action()
    {
        return static::FORM_ACTION;
    }

    /**
     * Render the form
     * @return string
     */
    public function render()
    {
        $missingParameters = array_diff(static::$requiredParameters, array_keys($this->parameters));

        if (! empty($missingParameters)) {
            $message = 'Missing arguments for Quickpay Form: ' . implode(', ', $missingParameters);
            throw new InvalidArgumentException($message);
        }

        $fields = [];
        foreach ($this->parameters as $parameter => $value) {
            $fields[] = sprintf('<input type="hidden" name="%s" value="%s">', $parameter, $value);
        }

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

Drop __toString to allow exceptions

Drop __toString to allow exceptions


<?php

require_once 'Site/exceptions/SiteNotFoundException.php';
require_once 'Site/layouts/SiteXMLRPCServerLayout.php';
require_once 'Site/SitePageFactory.php';

/**
 * @package   Site
 * @copyright 2006 silverorange
 */
class SiteXMLRPCServerFactory extends SitePageFactory
{
	// {{{ public function __construct()

	public function __construct()
	{
		$this->class_map['Site'] = 'Site/pages';
	}

	// }}}
	// {{{ public function resolvePage()

	public function resolvePage(SiteWebApplication $app, $source)
	{
		$layout = $this->resolveLayout($app, $source);
		$map = $this->getPageMap();

		if (isset($map[$source])) {
			$class = $map[$source];
			$params = array($app, $layout);
			$page = $this->instantiatePage($app, $class, $params);
			return $page;
		}

		throw new SiteNotFoundException();
	}

	// }}}
	// {{{ protected function getPageMap()

	protected function getPageMap()
	{
		return array(
			'upload-status' => 'SiteUploadStatusServer',
		);
	}

	// }}}
	// {{{ protected function resolveLayout()

	protected function resolveLayout($app, $source)
	{
		return new SiteXMLRPCServerLayout($app);
	}

	// }}}
}

?>

<?php

require_once 'Site/exceptions/SiteNotFoundException.php';
require_once 'Site/layouts/SiteXMLRPCServerLayout.php';
require_once 'Site/SitePageFactory.php';

/**
 * @package   Site
 * @copyright 2006-2008 silverorange
 */
class SiteXMLRPCServerFactory extends SitePageFactory
{
	// {{{ public function get()

	public function ($source, SiteLayout $layout = null)
	{
		$layout = ($layout === null) ? $this->getLayout($source) : $layout;
		$map = $this->getPageMap();

		if (!isset($map[$source])) {
			throw new SiteNotFoundException();
		}

		$class = $map[$source];
		return $this->getPage($class, $layout);
	}

	// }}}
	// {{{ protected function getPageMap()

	protected function getPageMap()
	{
		return array(
			'upload-status' => 'SiteUploadStatusServer',
		);
	}

	// }}}
	// {{{ protected function getLayout()

	protected function getLayout($source)
	{
		return new SiteXMLRPCServerLayout($this->app);
	}

	// }}}
}

?>

Update XMLRPC page factory to new page factory API.

svn commit r35170


<?php
/**
 * tobiju
 *
 * @link      https://github.com/tobiju/bookdown-bootswatch-templates for the canonical source repository
 * @copyright Copyright (c) 2015 Tobias Jüschke
 * @license   https://github.com/tobiju/bookdown-bootswatch-templates/blob/master/LICENSE.txt New BSD License
 */

    if (!$this->page->hasTocEntries()) {
        return;
    }
?>

<?= $this->page->getNumberAndTitle(); ?>

    <?php
    $entries = $this->page->getTocEntries();
    $baseLevel = reset($entries)->getLevel();
    $lastLevel = $baseLevel;
    $currLevel = $lastLevel;

    foreach ($entries as $entry) {
        $number = trim($entry->getNumber(),'.');

        echo '
';
        echo ''."{$number}".'	';
        echo ''. $this->anchorRaw($entry->getHref(), $entry->getTitle()) . '	';
        echo '
';

        $lastLevel = $entry->getLevel();
    }

    ?>

<?php
/**
 * tobiju
 *
 * @link      https://github.com/tobiju/bookdown-bootswatch-templates for the canonical source repository
 * @copyright Copyright (c) 2015 Tobias Jüschke
 * @license   https://github.com/tobiju/bookdown-bootswatch-templates/blob/master/LICENSE.txt New BSD License
 */

    if (!$this->page->hasTocEntries()) {
        return;
    }
?>

<?= $this->page->getNumberAndTitle(); ?>

    <?php
    $entries = $this->page->getTocEntries();
    $baseLevel = reset($entries)->getLevel();
    $lastLevel = $baseLevel;
    $currLevel = $lastLevel;

    foreach ($entries as $entry) {
        $number = trim($entry->getNumber(),'.');

        echo '
';
        echo '
'."{$number}".'
';
        echo '
'. $this->anchorRaw($entry->getHref(), $entry->getTitle()) . '
';
        echo '
';

        $lastLevel = $entry->getLevel();
    }

    ?>

Use list based markup for TOC instead of a table


<?php
namespace Payum\Core\Bridge\Twig;

class TwigFactory
{
    /**
     * @return \Twig_Environment
     */
    public static function createGeneric()
    {
        $loader = new \Twig_Loader_Filesystem();
        foreach (static::createGenericPaths() as $path => $namespace) {
            $loader->addPath($path, $namespace);
        }

        return new \Twig_Environment($loader);
    }

    /**
     * @param string $paymentFactoryOrRootClass
     *
     * @return string|null
     */
    public static function guessViewsPath($paymentFactoryOrRootClass)
    {
        if (false == class_exists($paymentFactoryOrRootClass)) {
            return;
        }

        $rc = new \ReflectionClass($paymentFactoryOrRootClass);

        return dirname($rc->getFileName()).'/Resources/views';
    }

    /**
     * @return string[]
     */
    protected static function createGenericPaths()
    {
        return array_flip(array_filter(array(
            'PayumCore' => self::guessViewsPath('Payum\Core\Payment'),
            'PayumStripe' => self::guessViewsPath('Payum\Stripe\JsPaymentFactory'),
            'PayumKlarnaCheckout' => self::guessViewsPath('Payum\Klarna\Checkout\PaymentFactory'),
            'PayumSymfonyBridge' => self::guessViewsPath('Payum\Core\Bridge\Symfony\ReplyToSymfonyResponseConverter'),
        )));
    }
}

<?php
namespace Payum\Core\Bridge\Twig;

class TwigFactory
{
    /**
     * @return string[]
     */
    public static function createGenericPaths()
    {
        return array_flip(array_filter(array(
            'PayumCore' => self::guessViewsPath('Payum\Core\Payment'),
            'PayumStripe' => self::guessViewsPath('Payum\Stripe\JsPaymentFactory'),
            'PayumKlarnaCheckout' => self::guessViewsPath('Payum\Klarna\Checkout\PaymentFactory'),
            'PayumSymfonyBridge' => self::guessViewsPath('Payum\Core\Bridge\Symfony\ReplyToSymfonyResponseConverter'),
        )));
    }

    /**
     * @return \Twig_Environment
     */
    public static function createGeneric()
    {
        $loader = new \Twig_Loader_Filesystem();
        foreach (static::createGenericPaths() as $path => $namespace) {
            $loader->addPath($path, $namespace);
        }

        return new \Twig_Environment($loader);
    }

    /**
     * @param string $paymentFactoryOrRootClass
     *
     * @return string|null
     */
    public static function guessViewsPath($paymentFactoryOrRootClass)
    {
        if (false == class_exists($paymentFactoryOrRootClass)) {
            return;
        }

        $rc = new \ReflectionClass($paymentFactoryOrRootClass);

        return dirname($rc->getFileName()).'/Resources/views';
    }
}

Revert "[twig] make method to be protected."

This reverts commit a677e9f8a3480937f1bdc3b322d978222d4157c1.


<?php

namespace ZfModuleTest\View\Helper;

use PHPUnit_Framework_TestCase;
use ZfModule\Mapper;
use ZfModule\View\Helper;

class TotalModulesTest extends PHPUnit_Framework_TestCase
{
    public function testInvokeReturnsNumberOfTotalModules()
    {
        $totalModules = 9000;

        $moduleMapper = $this->getMockBuilder(Mapper\Module::class)
            ->disableOriginalConstructor()
            ->getMock()
        ;

        $moduleMapper
            ->expects($this->once())
            ->method('getTotal')
            ->willReturn($totalModules)
        ;

        $helper = new Helper\TotalModules($moduleMapper);

        $this->assertSame($totalModules, $helper());
    }
}

<?php

namespace ZfModuleTest\View\Helper;

use PHPUnit_Framework_TestCase;
use ReflectionObject;
use ZfModule\Mapper;
use ZfModule\View\Helper;

class TotalModulesTest extends PHPUnit_Framework_TestCase
{
    public function testInvokeReturnsNumberOfTotalModules()
    {
        $totalModules = 9000;

        $moduleMapper = $this->getMockBuilder(Mapper\Module::class)
            ->disableOriginalConstructor()
            ->getMock()
        ;

        $moduleMapper
            ->expects($this->once())
            ->method('getTotal')
            ->willReturn($totalModules)
        ;

        $helper = new Helper\TotalModules($moduleMapper);

        $this->assertSame($totalModules, $helper());
    }

    public function testInvokeDoesNotFetchTotalModulesWhenAlreadyFetched()
    {
        $totalModules = 9000;

        $moduleMapper = $this->getMockBuilder(Mapper\Module::class)
            ->disableOriginalConstructor()
            ->getMock()
        ;

        $moduleMapper
            ->expects($this->never())
            ->method('getTotal')
        ;

        $helper = new Helper\TotalModules($moduleMapper);

        $reflection = new ReflectionObject($helper);

        $property = $reflection->getProperty('total');

        $property->setAccessible(true);
        $property->setValue($helper, $totalModules);

        $this->assertSame($totalModules, $helper());
    }
}

Fix: Add test for lazy loading of total number of modules


<?php

#sleep(2);

$feed = new sspmod_discojuice_Feed();

if (!empty($_REQUEST['refresh'])) {
	$feed->store();
	$data = $feed->read();
} else {
	$data = $feed->read();
}

if (!empty($_REQUEST['debug'])) {

	header('Content-Type: text/plain; charset=utf-8');
	print_r($data);

}

header('Content-Type: application/json; charset=utf-8');

if(isset($_REQUEST['callback'])) {
	echo $_REQUEST['callback'] . '(' . $data . ');';
} else {
	echo $data;
}

<?php

#sleep(2);

$feed = new sspmod_discojuice_Feed();

if (!empty($_REQUEST['refresh'])) {
	$feed->store();
	$data = $feed->read();
} else {
	$data = $feed->read();
}

if (!empty($_REQUEST['debug'])) {

	header('Content-Type: text/plain; charset=utf-8');
	print_r(json_decode($data, 'utf-8'));
	exit;
}

header('Content-Type: application/json; charset=utf-8');

if(isset($_REQUEST['callback'])) {
	echo $_REQUEST['callback'] . '(' . $data . ');';
} else {
	echo $data;
}

Improve DiscoJuice Feed debug view

Improve DiscoJuice Feed debug view

git-svn-id: a243b28a2a52d65555a829a95c8c333076d39ae1@2900 44740490-163a-0410-bde0-09ae8108e29a


<?php

$REGISTER_LTI2 = array(
"name" => "Simple Attendance Tool",
"short_name" => "Attendance Tool",
"description" => "This is a simple attendance tool that allows the instructor to set a code and the students enter the code."
);

<?php

$REGISTER_LTI2 = array(
"name" => "Simple Attendance Tool",
"FontAwesome" => "fa-server",
"short_name" => "Attendance Tool",
"description" => "This is a simple attendance tool that allows the instructor to set a code and the students enter the code."
);

Add FontAwesome icons to the tool registration.


<!doctype html>

	<title>FluxBB</title>

Not installed

It looks like FluxBB has not been installed yet.

@if ($has_installer)

Please visit {{ HTML::link_to_action('fluxbb_installer::home@start') }} to install the software.

@else

As you do not seem to have the graphical installer in your system, you can install FluxBB by running the following commands from the command line:

php artisan fluxbb::install:database mysql host dbname user:pass prefix
php artisan --env=fluxbb fluxbb::install:structure
php artisan --env=fluxbb fluxbb::install:board "Board name" "Board description"
php artisan --env=fluxbb fluxbb::install:admin username password email

@endif

<!DOCTYPE html>

	<title>FluxBB</title>

Not installed

It looks like FluxBB has not been installed yet.

@if ($has_installer)

Please visit {{ HTML::link_to_action('fluxbb_installer::home@start') }} to install the software.

@else

As you do not seem to have the graphical installer in your system, you can install FluxBB by running the following commands from the command line:

php artisan fluxbb::install:database mysql host dbname user:pass prefix
php artisan --env=fluxbb fluxbb::install:structure
php artisan --env=fluxbb fluxbb::install:config
php artisan --env=fluxbb fluxbb::install:board "Board name" "Board description"
php artisan --env=fluxbb fluxbb::install:groups
php artisan --env=fluxbb fluxbb::install:admin username password email

@endif

Update command line installation instructions.


<?php

namespace Minify\Test;

use Minify_HTML_Helper;

/**
 * @requires php < 7.3
 */
class LessSourceTest extends TestCase
{
    public function setUp()
    {
        $this->realDocRoot = $_SERVER['DOCUMENT_ROOT'];
        $_SERVER['DOCUMENT_ROOT'] = self::$document_root;
    }

    /**
     * @link https://github.com/mrclay/minify/issues/500
     */
    public function testLessTimestamp()
    {
        $baseDir = self::$test_files;

        $mainLess = "$baseDir/main.less";
        $includedLess = "$baseDir/included.less";

        // touch timestamp with 1s difference
        touch($mainLess);
        sleep(1);
        touch($includedLess);

        $mtime1 = filemtime($mainLess);
        $mtime2 = filemtime($includedLess);

        $max = max($mtime1, $mtime2);

        $options = array(
            'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php",
        );
        $res = Minify_HTML_Helper::getUri('less', $options);

        $this->assertEquals("/min/g=less&{$max}", $res);
    }
}

<?php

namespace Minify\Test;

use Minify_HTML_Helper;

/**
 * @requires php < 7.3
 * @see https://github.com/mrclay/minify/pull/685
 */
class LessSourceTest extends TestCase
{
    public function setUp()
    {
        $this->realDocRoot = $_SERVER['DOCUMENT_ROOT'];
        $_SERVER['DOCUMENT_ROOT'] = self::$document_root;
    }

    /**
     * @link https://github.com/mrclay/minify/issues/500
     */
    public function testLessTimestamp()
    {
        $baseDir = self::$test_files;

        $mainLess = "$baseDir/main.less";
        $includedLess = "$baseDir/included.less";

        // touch timestamp with 1s difference
        touch($mainLess);
        sleep(1);
        touch($includedLess);

        $mtime1 = filemtime($mainLess);
        $mtime2 = filemtime($includedLess);

        $max = max($mtime1, $mtime2);

        $options = array(
            'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php",
        );
        $res = Minify_HTML_Helper::getUri('less', $options);

        $this->assertEquals("/min/g=less&{$max}", $res);
    }
}

Disable less tests on php 7.4+

Disable less tests on php 7.4+


<?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\Formatter;

use Behat\Transliterator\Transliterator;

final class StringInflector
{
    public static function codeToName(string $value): string
    {
        return ucfirst(str_replace('_', ' ', $value));
    }

    public static function nameToCode(string $value): string
    {
        return str_replace([' ', '-', '\''], '_', $value);
    }

    public static function nameToSlug(string $value): string
    {
        return str_replace(['_'], '-', self::nameToLowercaseCode(Transliterator::transliterate($value)));
    }

    public static function nameToLowercaseCode(string $value): string
    {
        return strtolower(self::nameToCode($value));
    }

    public static function nameToUppercaseCode(string $value): string
    {
        return strtoupper(self::nameToCode($value));
    }

    public static function nameToCamelCase(string $value): string
    {
        return lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $value))));
    }

    private function __construct()
    {
    }
}

<?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\Formatter;

use Behat\Transliterator\Transliterator;
use function Symfony\Component\String\u;

final class StringInflector
{
    public static function codeToName(string $value): string
    {
        return ucfirst(str_replace('_', ' ', $value));
    }

    public static function nameToCode(string $value): string
    {
        return str_replace([' ', '-', '\''], '_', $value);
    }

    public static function nameToSlug(string $value): string
    {
        return str_replace(['_'], '-', self::nameToLowercaseCode(Transliterator::transliterate($value)));
    }

    public static function nameToLowercaseCode(string $value): string
    {
        return strtolower(self::nameToCode($value));
    }

    public static function nameToUppercaseCode(string $value): string
    {
        return strtoupper(self::nameToCode($value));
    }

    public static function nameToCamelCase(string $value): string
    {
        return (string) u($value)->camel();
    }

    private function __construct()
    {
    }
}

Bring back String u function

Bring back String u function


<!-- jQuery -->
<script src="<?php echo base_url('assets/js/libs/jquery.js')?>"></script>

<!-- Plugins -->
<script src="<?php echo base_url('assets/js/plugins.js')?>"></script>

<!-- Main -->
<script src="<?php echo base_url('assets/js/main.js')?>"></script>

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
    (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
    function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
    e=o.createElement(i);r=o.getElementsByTagName(i)[0];
    e.src='//www.google-analytics.com/analytics.js';
    r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
    ga('create','UA-XXXXX-X','auto');ga('send','pageview');
</script>

</body>

</html>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-104380197-1', 'auto');
ga('send', 'pageview');

</script>

<!-- jQuery -->
<script src="<?php echo base_url('assets/js/libs/jquery.js')?>"></script>

<!-- Plugins -->
<script src="<?php echo base_url('assets/js/plugins.js')?>"></script>

<!-- Main -->
<script src="<?php echo base_url('assets/js/main.js')?>"></script>

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->

</body>

</html>

Add the google analytics traking

Add the google analytics traking


<?php

namespace OpenClassrooms\Bundle\OneSkyBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * @author Romain Kuzniak <romain.kuzniak@openclassrooms.com>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('openclassrooms_onesky');
        $rootNode->children()
            ->scalarNode('api_key')->isRequired()->cannotBeEmpty()->end()
            ->scalarNode('api_secret')->isRequired()->cannotBeEmpty()->end()
            ->scalarNode('project_id')->isRequired()->cannotBeEmpty()->end()
            ->scalarNode('file_format')->cannotBeEmpty()->defaultValue('xliff')->end()
            ->scalarNode('source_locale')->cannotBeEmpty()->defaultValue('en')->end()
            ->arrayNode('locales')->isRequired()->cannotBeEmpty()->prototype('scalar')->end()->end()
            ->arrayNode('file_paths')->isRequired()->cannotBeEmpty()->prototype('scalar')->end()->end()
            ->scalarNode('keep_all_strings')->cannotBeEmpty()->defaultValue(true)->end()
            ->end();

        return $treeBuilder;
    }
}

<?php

namespace OpenClassrooms\Bundle\OneSkyBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * @author Romain Kuzniak <romain.kuzniak@openclassrooms.com>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('openclassrooms_onesky');
        $rootNode->children()
            ->scalarNode('api_key')->isRequired()->cannotBeEmpty()->end()
            ->scalarNode('api_secret')->isRequired()->cannotBeEmpty()->end()
            ->scalarNode('project_id')->isRequired()->cannotBeEmpty()->end()
            ->scalarNode('file_format')->cannotBeEmpty()->defaultValue('xliff')->end()
            ->scalarNode('source_locale')->cannotBeEmpty()->defaultValue('en')->end()
            ->arrayNode('locales')->requiresAtLeastOneElement()->cannotBeEmpty()->prototype('scalar')->end()->end()
            ->arrayNode('file_paths')->requiresAtLeastOneElement()->cannotBeEmpty()->prototype('scalar')->end()->end()
            ->scalarNode('keep_all_strings')->cannotBeEmpty()->defaultValue(true)->end()
            ->end();

        return $treeBuilder;
    }
}

Use requiresAtLeastOneElement() instead of cannotBeEmpty()

Symfony deprecation
https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L428


<?php
/**
 * Model
 *
 * @author: Michal Hojgr <michal.hojgr@gmail.com>
 *
 */

class ModLoader {

	/**
	 * @var Cache
	 */
	private $cache;
	/**
	 * @var ModMapper
	 */
	private $modMapper;

	/**
	 * @param Cache $cache
	 * @param ModMapper $modMapper
	 */
	public function __construct(Cache $cache, ModMapper $modMapper)
	{
		$this->cache = $cache;
		$this->modMapper = $modMapper;
	}

	/**
	 * Loads all versions, caches them and in case that
	 * cache was made recently, it reads from cache
	 *
	 * @return array
	 */
	public function getVersions() {

		/**
		 * Load from cache
		 */
		$files = $this->cache->getCachedVersions($this->modMapper);

		/**
		 * Get latest version and the others
		 */
		$latest = $files[0];
		unset($files[0]);

		$others = array_values($files);

		return array("latest" => $latest, "others" => $others);
	}
}

<?php
/**
 * Model
 *
 * @author: Michal Hojgr <michal.hojgr@gmail.com>
 *
 */

class ModLoader {

	/**
	 * @var Cache
	 */
	private $cache;
	/**
	 * @var ModMapper
	 */
	private $modMapper;

	/**
	 * @param Cache $cache
	 * @param ModMapper $modMapper
	 */
	public function __construct(Cache $cache, ModMapper $modMapper)
	{
		$this->cache = $cache;
		$this->modMapper = $modMapper;
	}

	/**
	 * Loads all versions, caches them and in case that
	 * cache was made recently, it reads from cache
	 *
	 * @param int $count how many versions to show
	 * @param int $start
	 * @return array
	 */
	public function getVersions($count, $start = 0) {

		/**
		 * Load from cache
		 */
		$files = $this->cache->getCachedVersions($this->modMapper);

		/**
		 * Get latest version and the others
		 */
		$latest = $files[0];
		unset($files[0]);

		$others = array_values($files);

		// buffer count so it must not count every loop
		$buffer_count = count($others);

		for($i = 0; $i < $count; $i++) {
			if($i < $start || $i > $start + $count)
				unset($others[$i]);
		}

		return array("latest" => $latest, "others" => $others);
	}
}

Add possibility to choose how many versions to show


<?php

class JSONLoader extends Element {

	public function output($args) {
		$id = rand(0,100000);

		echo("

		");
	}

}

?>

Add a CSS parameter for JSON blocks

Add a CSS parameter for JSON blocks


<?php namespace Zara4\API\Communication;

class Config {

  const VERSION    = '1.1.0';
  const USER_AGENT = 'Zara 4 PHP-SDK, Version-1.1.0';

  const PRODUCTION_API_ENDPOINT = "https://api.zara4.com";
  const DEVELOPMENT_API_ENDPOINT = "http://api.zara4.dev";

  private static $BASE_URL = self::PRODUCTION_API_ENDPOINT;

  // --- --- --- --- ---

  /**
   * Get the base url.
   *
   * @return string
   */
  public static function BASE_URL() {
    return self::$BASE_URL;
  }

  /**
   * Configure production mode.
   */
  public static function enterProductionMode() {
    self::$BASE_URL = self::PRODUCTION_API_ENDPOINT;
  }

  /**
   * Configure development mode.
   */
  public static function enterDevelopmentMode() {
    self::$BASE_URL = self::DEVELOPMENT_API_ENDPOINT;
  }

}

<?php namespace Zara4\API\Communication;

class Config {

  const VERSION    = '1.2.3';
  const USER_AGENT = 'Zara 4 PHP-SDK, Version-1.2.3';

  const PRODUCTION_API_ENDPOINT = "https://api.zara4.com";
  const DEVELOPMENT_API_ENDPOINT = "http://api.zara4.dev";

  public static $BASE_URL = self::PRODUCTION_API_ENDPOINT;

  // --- --- --- --- ---

  /**
   * Get the base url.
   *
   * @return string
   */
  public static function BASE_URL() {
    return self::$BASE_URL;
  }

  /**
   * Set the base url
   *
   * @param $baseUrl
   */
  public static function setBaseUrl($baseUrl) {
    self::$BASE_URL = $baseUrl;
  }

  /**
   * Configure production mode.
   */
  public static function enterProductionMode() {
    self::setBaseUrl(self::PRODUCTION_API_ENDPOINT);
  }

  /**
   * Configure development mode.
   */
  public static function enterDevelopmentMode() {
    self::setBaseUrl(self::DEVELOPMENT_API_ENDPOINT);
  }

}

Update communication configuration class to allow the base url to be set for the purpose of testing


<?php
require_once('../inc/config.php');
require_once(CONTROLLERS_PATH.'page_controller.php');

//routing
$path = array_key_exists('path', $_GET) ? $_GET['path'] : '';
if(preg_match('/^suggestions/', $path)){
	$page_controller = new AGED_Suggestions_Controller();
}
else if(preg_match('/^rated/', $path)){
	$page_controller = new AGED_Rated_Controller();
}
else{
	$page_controller = new AGED_Index_Controller();
}

//required for add movie modal
$movie_genre_result = AGED_Page_Controller::get_movie_genre_result();

include(VIEWS_PATH.'layout.php');

<?php
require_once('../inc/config.php');
require_once(CONTROLLERS_PATH.'page_controller.php');

//routing
$request_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

if(preg_match('#^/suggestions#', $request_path)){
	$page_controller = new AGED_Suggestions_Controller();
}
else if(preg_match('#^/rated#', $request_path)){
	$page_controller = new AGED_Rated_Controller();
}
else{
	$page_controller = new AGED_Index_Controller();
}

//required for add movie modal
$movie_genre_result = AGED_Page_Controller::get_movie_genre_result();

include(VIEWS_PATH.'layout.php');

Refactor page routing to use request uri path instead of query argument


<?php

namespace App\Controllers;

use App\Entities\Lead;

class LeadController extends BaseController
{
    /**
     * Validations rules to $_POST data
     * @var [array]
     */
    protected $rules = [
            'required' => [
                ['name'],
                ['email'],
            ],
            'lengthMin' => [
                ['name', 3],
            ],

            'email' => 'email',
        ];

    /**
     * Input labels
     * @var array
     */
    protected $labels = [
        'name'  => 'Name',
        'email' => 'Email',
    ];

    public function store($request, $response)
    {

        $lead            = new Lead();
        $lead->name      = $request->getParam('name');
        $lead->email     = $request->getParam('email');
        $lead->date      = date('Y-m-d H:i:s');

        if (!$lead->isRegistered($lead->email)) {
            $lead->save();
        }

        sendEmail($lead->email, $lead->name, getenv('LEAD_EMAIL_SUBJECT'), 'lead', $lead);
        sendEmail(getenv('ADMIN_EMAIL'), 'Edwin Ramírez', getenv('LEAD_EMAIL_SUBJECT'), 'admin', $lead);

	    return $response->withRedirect('/thanks', 301);
    }
}

<?php

namespace App\Controllers;

use App\Entities\Lead;
use Slim\Http\Request;
use Slim\Http\Response;

class LeadController extends BaseController
{
    public function store(Request $request, Response $response)
    {
    	$this->container->validator->validate($request, [
    		'name' => ['required'],
    		'email' => ['required', 'email'],
	    ]);

    	if ($this->container->validator->failed()) {
			return $response->withRedirect($this->container->router->pathFor('home'), 302);
	    }

        $lead            = new Lead();
        $lead->name      = $request->getParam('name');
        $lead->email     = $request->getParam('email');
        $lead->date      = date('Y-m-d H:i:s');

        if (!$lead->isRegistered($lead->email)) {
            $lead->save();
        }

        sendEmail($lead->email, $lead->name, getenv('LEAD_EMAIL_SUBJECT'), 'lead', $lead);
        sendEmail(getenv('ADMIN_EMAIL'), 'Edwin Ramírez', getenv('LEAD_EMAIL_SUBJECT'), 'admin', $lead);

	    return $response->withRedirect($this->container->router->pathFor('thanks'), 201);
    }
}

Add validation to store method on Lead controller


<?php

namespace Orchestra\Contracts\Publisher;

interface Publisher
{
    /**
     * Publish extension.
     *
     * @param  string  $name
     *
     * @return void
     */
    public function extension(string $name): void;

    /**
     * Publish Orchestra Platform.
     *
     * @return void
     */
    public function foundation(): void;
}

<?php

namespace Orchestra\Contracts\Publisher;

interface Publisher
{
    /**
     * Publish extension.
     *
     * @param  string  $name
     *
     * @return bool
     */
    public function extension(string $name): bool;

    /**
     * Publish Orchestra Platform.
     *
     * @return bool
     */
    public function foundation(): bool;
}

Return type should be boolean.

Return type should be boolean.

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


<?php

/*
 * The MIT License
 *
 * Copyright 2017 guillaume.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

namespace Rad\Errors;

use ErrorException;
use JsonSerializable;
use Serializable;

/**
 * Description of DefaultError
 *
 * @author guillaume
 */
abstract class RadError extends ErrorException implements JsonSerializable, Serializable {

    public function __toString() {
        return $this->message;
    }

    public function serialize(): string {
        return null;
    }

    public function unserialize($serialized) {

    }

    public function jsonSerialize() {
        return json_encode((array) $this);
    }

}

<?php

/*
 * The MIT License
 *
 * Copyright 2017 guillaume.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

namespace Rad\Errors;

use ErrorException;
use JsonSerializable;

/**
 * Description of DefaultError
 *
 * @author guillaume
 */
abstract class RadError extends ErrorException implements JsonSerializable {

    public function __toString() {
        return $this->message;
    }

    public function jsonSerialize() {
        return json_encode((array) $this);
    }

}

Remove serialize interface from raderror


<?php declare(strict_types=1);

namespace Onion\Console\Router;

use Onion\Framework\Console\Interfaces\ArgumentParserInterface;
use Onion\Framework\Console\Interfaces\CommandInterface;

class Router
{
    /**
     * @var array
     */
    private $commands;

    /**
     * @var CommandInterface[]
     */
    private $handlers;

    private $argumentParser;
    public function __construct(ArgumentParserInterface $argumentParser)
    {
        $this->argumentParser = $argumentParser;
    }

    public function addCommand(string $name, CommandInterface $command, array $data = [])
    {
        $this->commands[$name] = $data;
        $this->handlers[$name] = $command;
    }

    public function match(string $command, array $arguments = []): array
    {
        if (!isset($this->handlers[$command])) {
            throw new \RuntimeException("Command '$command' not found");
        }

        $flags = array_keys($this->commands[$command]['flags']);
        $params = array_keys($this->commands[$command]['arguments']);

        $options = $this->argumentParser->parse($arguments, $flags, $params);

        return [$this->handlers[$command], $options];
    }
}

<?php declare(strict_types=1);

namespace Onion\Console\Router;

use Onion\Framework\Console\Interfaces\ArgumentParserInterface;
use Onion\Framework\Console\Interfaces\CommandInterface;

class Router
{
    /**
     * @var array
     */
    private $commands;

    /**
     * @var CommandInterface[]
     */
    private $handlers;

    private $argumentParser;
    public function __construct(ArgumentParserInterface $argumentParser)
    {
        $this->argumentParser = $argumentParser;
    }

    public function getAvailableCommands(): array
    {
        return array_keys($this->handlers);
    }

    public function getCommandData(string $command): array
    {
        return $this->commands[$command];
    }

    public function addCommand(string $name, CommandInterface $command, array $data = [])
    {
        $this->commands[$name] = $data;
        $this->handlers[$name] = $command;
    }

    public function match(string $command, array $arguments = []): array
    {
        if (!isset($this->handlers[$command])) {
            throw new \RuntimeException("Command '$command' not found");
        }

        $flags = array_keys($this->commands[$command]['flags']);
        $params = array_keys($this->commands[$command]['arguments']);

        $options = $this->argumentParser->parse($arguments, $flags, $params);

        return [$this->handlers[$command], $options];
    }
}

Add helper getters for commands metadata


<?php

class Appointment extends Eloquent {

	public static $key  = 'id';
	public static $table  = 'appointments';

	public static $timestamps = true;

	public static function get_events4today() {
		return DB::table(self::$table)->where_appointment_date(date('Y-m-d'))->get();
	}

	public function place() {
		return $this->belongs_to('Place');
	}

}

<?php

class Appointment extends Eloquent {

	public static $key  = 'id';
	public static $table  = 'appointments';

	public static $timestamps = true;

	public static function get_events4today() {
		return DB::table(self::$table)->where_appointment_date(date('Y-m-d'))->order_by('a_date_ts', 'ASC')->get();
	}

	public function place() {
		return $this->belongs_to('Place');
	}

}

Order events by date on the main page.

Order events by date on the main page.


<?php
//Test PHP Git Hooks

namespace AppBundle\Twig;

class AppExtension extends \Twig_Extension{

    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('covertosize', [$this, 'coverFunction'], [
                'is_safe' => ['html']
            ]),
        );
    }

    public function coverFunction($cover, $width, $height)
    {
        $img=sprintf('<img src="uploads/images%s" width="%s" height="%s">', $cover, $width, $height);
        return $img;
    }

    public function getName()
    {
        return 'app_extension';
    }
}

<?php
//Test PHP Git Hooks (2)

namespace AppBundle\Twig;

class AppExtension extends \Twig_Extension
{

    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('covertosize', [$this, 'coverFunction'], [
                'is_safe' => ['html']
            ]),
        );
    }

    public function coverFunction($cover, $width, $height)
    {
        $img=sprintf('<img src="uploads/images%s" width="%s" height="%s">', $cover, $width, $height);
        return $img;
    }

    public function getName()
    {
        return 'app_extension';
    }
}

Test php git hooks (2)

Test php git hooks (2)


<?php
/**
 * Created by PhpStorm.
 * User: Catalin
 * Date: 27-May-17
 * Time: 13:11
 */

$stid = oci_parse($connection, 'SELECT last_name, first_name, email FROM tutor WHERE username = :username');
$t_username = $_SESSION["t_username"];
oci_bind_by_name($stid, ':username', $t_username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
echo '
' . 'Nume	' . '' . $row[1] . '
';
echo '
' . 'Prenume	' . '' . $row[0] . '
';
echo '
' . 'E-mail	' . '' . $row[2] . '
';
oci_free_statement($stid);

$_SESSION["user"] = $t_username;
$_SESSION["pname"] = $row[1];
$_SESSION["surname"] = $row[0];
$_SESSION["email"] = $row[2];

oci_close($connection);

<?php
/**
 * Created by PhpStorm.
 * User: Catalin
 * Date: 27-May-17
 * Time: 13:11
 */

$stid = oci_parse($connection, 'SELECT last_name, first_name, email FROM tutor WHERE username = :username');
$t_username = $_SESSION["username"];
oci_bind_by_name($stid, ':username', $t_username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
echo '
' . 'Nume	' . '' . $row[1] . '
';
echo '
' . 'Prenume	' . '' . $row[0] . '
';
echo '
' . 'E-mail	' . '' . $row[2] . '
';
oci_free_statement($stid);

$_SESSION["user"] = $t_username;
$_SESSION["pname"] = $row[1];
$_SESSION["surname"] = $row[0];
$_SESSION["email"] = $row[2];

oci_close($connection);

Change session variable to username

Change session variable to username


<?php
/**
 * @author      Alex Bilbie <hello@alexbilbie.com>
 * @copyright   Copyright (c) Alex Bilbie
 * @license     http://mit-license.org/
 *
 * @link        https://github.com/thephpleague/oauth2-server
 */

namespace League\OAuth2\Server\Entities\Traits;

trait ClientTrait
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string|string[]
     */
    protected $redirectUri;

    /**
     * Get the client's name.
     *
     * @return string
     * @codeCoverageIgnore
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Returns the registered redirect URI (as a string).
     *
     * Alternatively return an indexed array of redirect URIs.
     *
     * @return string|string[]
     */
    public function getRedirectUri()
    {
        return $this->redirectUri;
    }
}

<?php
/**
 * @author      Alex Bilbie <hello@alexbilbie.com>
 * @copyright   Copyright (c) Alex Bilbie
 * @license     http://mit-license.org/
 *
 * @link        https://github.com/thephpleague/oauth2-server
 */

namespace League\OAuth2\Server\Entities\Traits;

trait ClientTrait
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string|string[]
     */
    protected $redirectUri;

    /**
     * @var bool
     */
    protected $isConfidential;

    /**
     * Get the client's name.
     *
     * @return string
     * @codeCoverageIgnore
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Returns the registered redirect URI (as a string).
     *
     * Alternatively return an indexed array of redirect URIs.
     *
     * @return string|string[]
     */
    public function getRedirectUri()
    {
        return $this->redirectUri;
    }

    /**
     * Returns true if the client is confidential.
     *
     * @return bool
     */
    public function isConfidential()
    {
        return $this->isConfidential;
    }
}

Add isConfidential function to client entity trait


<?php
/**
 * Copyright 2019 The WildPHP Team
 *
 * You should have received a copy of the MIT license with the project.
 * See the LICENSE file for more information.
 */

declare(strict_types=1);

namespace WildPHP\Core\Observers;

use Evenement\EventEmitterInterface;
use Psr\Log\LoggerInterface;
use WildPHP\Core\Configuration\Configuration;
use WildPHP\Core\Events\NicknameChangedEvent;

class BotNicknameObserver
{
    /**
     * @var Configuration
     */
    private $configuration;

    /**
     * @var LoggerInterface
     */
    private $logger;

    /**
     * BotStateManager constructor.
     *
     * @param Configuration $configuration
     * @param EventEmitterInterface $eventEmitter
     * @param LoggerInterface $logger
     */
    public function __construct(
        Configuration $configuration,
        EventEmitterInterface $eventEmitter,
        LoggerInterface $logger
    ) {
        $eventEmitter->on('user.nick', [$this, 'monitorBotNickname']);

        $this->configuration = $configuration;
        $this->logger = $logger;
    }

    /**
     * @param NicknameChangedEvent $event
     */
    public function monitorBotNickname(NicknameChangedEvent $event): void
    {
        if ($event->getOldNickname() !== $this->configuration['currentNickname']) {
            return;
        }

        $this->configuration['currentNickname'] = $event->getNewNickname();

        $this->logger->debug('Updated current nickname for bot', [
            'oldNickname' => $event->getOldNickname(),
            'newNickname' => $event->getNewNickname()
        ]);
    }
}

<?php
/**
 * Copyright 2019 The WildPHP Team
 *
 * You should have received a copy of the MIT license with the project.
 * See the LICENSE file for more information.
 */

declare(strict_types=1);

namespace WildPHP\Core\Observers;

use Evenement\EventEmitterInterface;
use Psr\Log\LoggerInterface;
use WildPHP\Core\Configuration\Configuration;
use WildPHP\Core\Events\NicknameChangedEvent;

class BotNicknameObserver
{
    /**
     * @var Configuration
     */
    private $configuration;

    /**
     * @var LoggerInterface
     */
    private $logger;

    /**
     * BotStateManager constructor.
     *
     * @param Configuration $configuration
     * @param EventEmitterInterface $eventEmitter
     * @param LoggerInterface $logger
     */
    public function __construct(
        Configuration $configuration,
        EventEmitterInterface $eventEmitter,
        LoggerInterface $logger
    ) {
        $eventEmitter->on('user.nick', [$this, 'monitorBotNickname']);

        $this->configuration = $configuration;
        $this->logger = $logger;
    }

    /**
     * @param NicknameChangedEvent $event
     */
    public function monitorBotNickname(NicknameChangedEvent $event): void
    {
        if ($event->getOldNickname() !== $this->configuration['currentNickname']) {
            return;
        }

        $this->configuration['currentNickname'] = $event->getNewNickname();

        $this->logger->debug('Updated current nickname configuration for bot', [
            'oldNickname' => $event->getOldNickname(),
            'newNickname' => $event->getNewNickname()
        ]);
    }
}

Make logging message more concise

Make logging message more concise

Signed-off-by: NanoSector <b9ab5d34593724ab32ad0f7d13d88750b7414e7b@nanosector.nl>


<?php
namespace ShopwareCli\Services;

/**
 * Class FileDownloader
 * @package ShopwareCli\Services
 */
class StreamFileDownloader
{
    /**
     * @var IoService
     */
    private $ioService;

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

    /**
     * @param string $sourceUrl
     * @param string $destination
     */
    public function download($sourceUrl, $destination)
    {

    }
}

<?php
namespace ShopwareCli\Services;

/**
 * Class FileDownloader
 * @package ShopwareCli\Services
 */
class StreamFileDownloader implements FileDownloader
{
    const BLOCKSIZE = 8192;

    /**
     * @var IoService
     */
    private $ioService;

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

    /**
     * @param string $sourceUrl
     * @param string $destination
     * @throws \RuntimeException
     */
    public function download($sourceUrl, $destination)
    {
        if (false === $readHandle = fopen($sourceUrl, "rb")) {
            throw new \RuntimeException(sprintf("Could not open URL '%s'.", $sourceUrl));
        }

        if (false === $writeHandle = fopen($destination, "wb")) {
            throw new \RuntimeException(sprintf("Could not write file: %s.", $destination));
        }

        $length = $this->getContentLengthFromStream($readHandle);

        $progress = $this->ioService->createProgressBar($length/1024);
        $progress->start();

        // update every 0.5 magabytes
        $progress->setRedrawFrequency(524288/1024);

        $currentSize = 0;

        while (!feof($readHandle)) {
            $currentSize += fwrite($writeHandle, fread($readHandle, self::BLOCKSIZE));
            $progress->setCurrent($currentSize/1024);
        }
        $progress->finish();

        $this->ioService->writeln("\n Download finished");

        fclose($readHandle);
        fclose($writeHandle);
    }

    /**
     * @param resource $readHandle
     * @return int
     */
    private function getContentLengthFromStream($readHandle)
    {
        $info = stream_get_meta_data($readHandle);

        $size = 0;
        foreach ($info['wrapper_data'] as $field) {
            if (stripos($field, 'content-length') !== false) {
                list($header, $size) = explode(':', $field);
            }
        }

        return $size;
    }
}

Add FileDownloader implementation using streams.


<?php namespace Xavrsl\Cas;

use Illuminate\Support\ServiceProvider;

class CasServiceProvider extends ServiceProvider {

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

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

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

}

<?php namespace Xavrsl\Cas;

use Illuminate\Support\ServiceProvider;

class CasServiceProvider extends ServiceProvider {

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

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app->singleton('cas', function()
		{
		    $config = $this->app['config']->get('cas');
			return new CasManager($config);
		});
	}

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

}

Switch to using container singleton in provider

Laravel 5.4 depreciated the app container share function


<?php

$githubProfile = file_get_contents('https://github.com/controversial');
$contributionsIndex = preg_match(
  '/contributions\s+in the last year/',
  $githubProfile,
  $matches,
  PREG_OFFSET_CAPTURE
);
$index = $matches[0][1];
$oldIndex = $index;

while (is_numeric($githubProfile[$index-2]) || $githubProfile[$index-2] == ',') {
  $index--;
}

echo(substr($githubProfile, $index-1, $oldIndex-$index));

?>

<?php

$githubProfile = file_get_contents('https://github.com/controversial');
$contributionsIndex = preg_match(
  '/contributions\s+in the last year/',
  $githubProfile,
  $matches,
  PREG_OFFSET_CAPTURE
);
$index = $matches[0][1];
$oldIndex = $index;

while (is_numeric($githubProfile[$index-2]) || $githubProfile[$index-2] == ',')
  $index--;

$contributionsCount = substr($githubProfile, $index-1, $oldIndex-$index);

echo(str_replace(',', '', $contributionsCount));

?>

Remove comma from PHP script output

Remove comma from PHP script output


<?php

declare( strict_types=1 );

use Isolated\Symfony\Component\Finder\Finder;

$polyfillsBootstrap = Finder::create()
                            ->files()
                            ->in( __DIR__ . '/vendor/symfony/polyfill-*' )
                            ->name( 'bootstrap.php' )
                            ->name( 'bootstrap80.php' );

return [
	'prefix' => 'WPSentry\\ScopedVendor',

	'finders' => [
		Finder::create()
		      ->files()
		      ->ignoreVCS( true )
		      ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' )
		      ->exclude( [
			      'doc',
			      'test',
			      'test_old',
			      'tests',
			      'Tests',
			      'vendor-bin',
		      ] )
		      ->in( 'vendor' ),
		Finder::create()->append( [
			'composer.json',
		] ),
	],

	'whitelist' => [
		'Sentry\\*',
		'Monolog\\*',
		'Symfony\\Polyfill\\*',
	],

	'files-whitelist' => array_merge( [
		'vendor/ralouphie/getallheaders/src/getallheaders.php',
	], array_map(
		static function ( $file ) {
			return $file->getPathName();
		},
		iterator_to_array( $polyfillsBootstrap )
	) ),

	'whitelist-global-classes'   => true,
	'whitelist-global-constants' => true,
	'whitelist-global-functions' => true,
];

<?php

declare( strict_types=1 );

use Isolated\Symfony\Component\Finder\Finder;

$symfonyPolyfills = ( static function (): array {
	$files = [];
	foreach (
		Finder::create()
		      ->files()
		      ->in( __DIR__ . '/vendor/symfony/polyfill-*' )
		      ->name( 'bootstrap.php' )
		      ->name( 'bootstrap80.php' ) as $bootstrap
	) {
		$files[] = $bootstrap->getPathName();
	}

	return $files;
} )();

return [
	'prefix' => 'WPSentry\\ScopedVendor',

	'finders' => [
		Finder::create()
		      ->files()
		      ->ignoreVCS( true )
		      ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' )
		      ->exclude( [
			      'doc',
			      'test',
			      'test_old',
			      'tests',
			      'Tests',
			      'vendor-bin',
		      ] )
		      ->in( 'vendor' ),
		Finder::create()->append( [
			'composer.json',
		] ),
	],

	'whitelist' => [
		'Sentry\\*',
		'Monolog\\*',
		'Symfony\\Polyfill\\*',
	],

	'files-whitelist' => array_merge( [
		'vendor/ralouphie/getallheaders/src/getallheaders.php',
	], $symfonyPolyfills ),

	'whitelist-global-classes'   => true,
	'whitelist-global-constants' => true,
	'whitelist-global-functions' => true,
];

Fix scoper code not working on PHP < 8

Fix scoper code not working on PHP < 8


<?php
include './core/bootstrap.php';

//connect to database
include 'dbconnect.php';

//check that user has a valid cookie, redirect if no valid cookie
include 'php_common/cookiecheck.php';

$workoutId = $_GET['wid'];
$workoutLoggingService = new WorkoutLoggingService();

$workoutInfo = $workoutLoggingService->getWorkoutInfo($workoutId);
$workoutUserId = $workoutInfo["userid"];

// Check that user of the workout_id_prev matches that of the cookie userid
if ($userid != $workoutUserId) {
    header('HTTP/1.1 500 Internal Server Error');
} else {
    $workoutLoggingService->deleteWorkout($workoutId);
}

?>

<?php
include './core/bootstrap.php';

//connect to database
include 'dbconnect.php';

//check that user has a valid cookie, redirect if no valid cookie
include 'php_common/cookiecheck.php';

$workoutId = $_GET['wid'];
$workoutLoggingService = new WorkoutLoggingService();

$workoutInfo = $workoutLoggingService->getWorkoutInfo($workoutId);
$workoutUserId = $workoutInfo["userid"];

// Check that user of the workout_id_prev matches that of the cookie userid
if ($userid != $workoutUserId) {
    header('HTTP/1.1 500 Internal Server Error');
} else {
    $workoutLoggingService->deleteWorkout($workoutId);

    //update records table
    include 'update-records-absolute.php';
}

?>

Update user records after workout delete


<?php

use \common\models\Team;

class TeamCommand extends \console\ext\ConsoleCommand
{

    /**
     * Method which deletes team with specified id
     *
     * @param string $id
     */
    public function actionDelete($id)
    {
        $teamToDelete = Team::model()->findByPk(new \MongoId((string)$id));
        if (isset($teamToDelete)) {
            $teamToDelete->delete();
            echo "Team with id={$id} was successfully deleted\n";
        } else {
            echo "Error! Team with id={$id} was not found\n";
        }
    }

}

<?php

use \common\models\Team;

class TeamCommand extends \console\ext\ConsoleCommand
{

    /**
     * Method which deletes team with specified id
     *
     * @param string $id
     */
    public function actionDelete($id)
    {
        $teamToDelete = Team::model()->findByPk(new \MongoId((string)$id));
        if (isset($teamToDelete)) {
            $teamToDelete->delete();
            echo "Team with id={$id} was successfully deleted\n";
        } else {
            echo "Error! Team with id={$id} was not found\n";
        }
    }

    /**
     * Method which deletes all the teams with isDeleted = true from the data storage
     */
    public function actionRemoveDeleted()
    {
        $teams = Team::model()->findAllByAttributes(array('isDeleted' => true));
        foreach ($teams as $team) {
            $team->delete();
            echo '.';
        }
        echo "\nAll 'deleted' teams have been removed from the data storage.\n";
    }

}

Implement console command to remove deleted teams from data storage


<?php
namespace Bendihossan\Pinfo\Command;

use Console_Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Bendihossan\Pinfo\Command\PinfoCommand;

class ExtensionsCommand extends PinfoCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('pinfo:exts')
            ->setDescription('Lists your PHP extensions.')
            ->setHelp('The <info>pinfo:env</info> lists your environment specific info')
            ;
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->newSection("Loaded Extensions", $output);

        $extensions = get_loaded_extensions();
        // Sort an array using a case insensitive "natural order" algorithm
        natcasesort($extensions);

        $table = new Console_Table();

        $table->setHeaders(array('Ext. Name'));

        foreach ($extensions as $extension) {
            $table->addRow(array($extension));
        }

        echo $table->getTable();

        print "\n";
    }
}

<?php
namespace Bendihossan\Pinfo\Command;

use Console_Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Bendihossan\Pinfo\Command\PinfoCommand;

class ExtensionsCommand extends PinfoCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('pinfo:exts')
            ->setDescription('Lists your PHP extensions.')
            ->setHelp('The <info>pinfo:env</info> lists your environment specific info')
            ;
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->newSection("Loaded Extensions", $output);

        $extensions = get_loaded_extensions();
        // Sort an array using a case insensitive "natural order" algorithm
        natcasesort($extensions);

        $table = new Console_Table();

        $table->setHeaders(array('Ext. Name'));

        foreach ($extensions as $extension) {
            $table->addRow(array($extension));
        }

        $output->write($table->getTable());

        print "\n";
    }
}

Use ->write() instead of echo

Use ->write() instead of echo


<!DOCTYPE html>

        <title>Print Table</title>
        <meta charset="UTF-8">
        <meta name=description content="">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

            @foreach($data as $row)
                @if ($row == reset($data))

                        @foreach($row as $key => $value)
                            {!! $key !!}
                        @endforeach

                @endif

                    @foreach($row as $key => $value)
                        @if (is_string($value) || trim($value)==='' || is_numeric($value))
                            {!! $value !!}
                        @endif
                    @endforeach

            @endforeach

<!DOCTYPE html>

        <title>Print Table</title>
        <meta charset="UTF-8">
        <meta name=description content="">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

            @foreach($data as $row)
                @if ($row == reset($data))

                        @foreach($row as $key => $value)
                            {!! $key !!}
                        @endforeach

                @endif

                    @foreach($row as $key => $value)
                        @if (is_string($value) || trim($value)==='' || is_numeric($value))
                            {!! $value !!}
                        @endif
                    @endforeach

            @endforeach

Remove media screen to fix styles when printing.


<?php

return array(

	/*
	|--------------------------------------------------------------------------
	| Password Reminder Language Lines
	|--------------------------------------------------------------------------
	|
	| The following language lines are the default lines which match reasons
	| that are given by the password broker for a password update attempt
	| has failed, such as for an invalid token or invalid new password.
	|
	*/

	"password" => "Passwords must be six characters and match the confirmation.",

	"user"     => "We can't find a user with that e-mail address.",

	"token"    => "This password reset token is invalid.",

);

<?php

return array(

	/*
	|--------------------------------------------------------------------------
	| Password Reminder Language Lines
	|--------------------------------------------------------------------------
	|
	| The following language lines are the default lines which match reasons
	| that are given by the password broker for a password update attempt
	| has failed, such as for an invalid token or invalid new password.
	|
	*/

	"password" => "Passwords must be at least six characters long and match the confirmation.",

	"user"     => "We can't find a user with that e-mail address.",

	"token"    => "This password reset token is invalid.",

);

Update password message for clarity

Update password message for clarity


<?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.
 */

namespace Sylius\Component\Sequence\Model;

class Sequence implements SequenceInterface
{
    /**
     * @var mixed
     */
    protected $id;

    /**
     * @var integer
     */
    protected $index = 0;

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

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

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

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

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

    /**
     * {@inheritdoc}
     */
    public function incrementIndex()
    {
        ++$this->index;
    }
}

<?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.
 */

namespace Sylius\Component\Sequence\Model;

class Sequence implements SequenceInterface
{
    /**
     * @var mixed
     */
    protected $id;

    /**
     * @var int
     */
    protected $index = 0;

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

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

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

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

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

    /**
     * {@inheritdoc}
     */
    public function incrementIndex()
    {
        ++$this->index;
    }
}

Introduce 3 new traits to reduce code duplication


<?php

namespace PhpWatson\Sdk\Tests\Language\RetrieveAndRank;

use PhpWatson\Sdk\Tests\AbstractTestCase;
use PhpWatson\Sdk\Language\RetrieveAndRank\V1\RetrieveAndRankService;

class RetrieveAndRankV1Test extends AbstractTestCase
{
    /**
     * @var RetrieveAndRankService
     */
    public $service;

    public function setUp()
    {
        parent::setUp();
        $this->service = new RetrieveAndRankService();
    }

    public function test_if_url_is_set()
    {
        $this->assertEquals(
            'https://watson-api-explorer.mybluemix.net/retrieve-and-rank/api',
            $this->service->getUrl()
        );
    }

    public function test_if_version_is_set()
    {
        $this->assertEquals(
            'v1',
            $this->service->getVersion()
        );
    }

    public function test_can_list_solr_clusters()
    {
        $response = $this->service->listSolrClusters();

        $this->assertArrayHasKey('clusters', json_decode($response->getBody()->getContents(), true));
    }
}

<?php

namespace PhpWatson\Sdk\Tests\Language\RetrieveAndRank;

use PhpWatson\Sdk\Tests\AbstractTestCase;
use PhpWatson\Sdk\Language\RetrieveAndRank\V1\RetrieveAndRankService;

class RetrieveAndRankV1Test extends AbstractTestCase
{
    /**
     * @var RetrieveAndRankService
     */
    public $service;

    public function setUp()
    {
        parent::setUp();
        $this->service = new RetrieveAndRankService();
    }

    public function test_if_url_is_set()
    {
        $this->assertEquals(
            'https://watson-api-explorer.mybluemix.net/retrieve-and-rank/api',
            $this->service->getUrl()
        );
    }

    public function test_if_version_is_set()
    {
        $this->assertEquals(
            'v1',
            $this->service->getVersion()
        );
    }

    public function test_can_list_solr_clusters()
    {
        $response = $this->service->listSolrClusters();

        $this->assertArrayHasKey('clusters', json_decode($response->getContent(), true));
    }
}

Refactor for using the new Response class


<?php

namespace Kibo\Phast\Filters\Image;

use Kibo\Phast\Filters\Image\ImageImplementations\DummyImage;

abstract class ExternalAppImageFilter implements ImageFilter {

    /**
     * @var array
     */
    protected $config;

    /**
     * @param Image $image
     * @return bool
     */
    abstract protected function shouldApply(Image $image);

    /**
     * @return string
     */
    abstract protected function getCommand();

    /**
     * PNGCompressionImageFilter constructor.
     *
     * @param array $config
     */
    public function __construct(array $config) {
        $this->config = $config;
    }

    public function transformImage(Image $image) {
        if (!$this->shouldApply($image)) {
            return $image;
        }
        $proc = proc_open($this->getCommand(), [['pipe', 'r'], ['pipe', 'w']], $pipes);
        if (!is_resource($proc)) {
            return $image;
        }
        fwrite($pipes[0], $image->getAsString());
        fclose($pipes[0]);

        $compressed = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        proc_close($proc);

        $newImage = new DummyImage();
        $newImage->setImageString($compressed);
        $newImage->setType(Image::TYPE_PNG);
        return $newImage;
    }

}

<?php

namespace Kibo\Phast\Filters\Image;

use Kibo\Phast\Filters\Image\ImageImplementations\DummyImage;

abstract class ExternalAppImageFilter implements ImageFilter {

    /**
     * @var array
     */
    protected $config;

    /**
     * @param Image $image
     * @return bool
     */
    abstract protected function shouldApply(Image $image);

    /**
     * @return string
     */
    abstract protected function getCommand();

    /**
     * PNGCompressionImageFilter constructor.
     *
     * @param array $config
     */
    public function __construct(array $config) {
        $this->config = $config;
    }

    public function transformImage(Image $image) {
        if (!$this->shouldApply($image)) {
            return $image;
        }

        $command = $this->getCommand();

        $proc = proc_open($this->getCommand(), [['pipe', 'r'], ['pipe', 'w']], $pipes);

        if (!is_resource($proc)) {
            return $image;
        }

        fwrite($pipes[0], $image->getAsString());
        fclose($pipes[0]);

        $compressed = stream_get_contents($pipes[1]);
        fclose($pipes[1]);

        $status = proc_close($proc);

        if ($status != 0) {
            throw new RuntimeException("External image processing command failed with status {$status}: {$command}");
        }

        if ($compressed == '') {
            throw new RuntimeException("External image processing command did not output anything: {$command}");
        }

        $newImage = new DummyImage();
        $newImage->setImageString($compressed);
        $newImage->setType(Image::TYPE_PNG);

        return $newImage;
    }

}

Handle errors in external command

Handle errors in external command


<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Stripe, Mailgun, Mandrill, and others. This file provides a sane
    | default location for this type of information, allowing packages
    | to have a conventional place to find your various credentials.
    |
    */

    'mailgun' => [
        'domain' => env('MAILGUN_DOMAIN'),
        'secret' => env('MAILGUN_SECRET'),
    ],

    'mandrill' => [
        'secret' => env('MANDRILL_SECRET'),
    ],

    'ses' => [
        'key' => env('SES_KEY'),
        'secret' => env('SES_SECRET'),
        'region' => 'us-east-1',
    ],

    'sparkpost' => [
        'secret' => env('SPARKPOST_SECRET'),
    ],

    'stripe' => [
        'model' => App\User::class,
        'key' => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),
    ],

];

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Stripe, Mailgun, SparkPost and others. This file provides a sane
    | default location for this type of information, allowing packages
    | to have a conventional place to find your various credentials.
    |
    */

    'mailgun' => [
        'domain' => env('MAILGUN_DOMAIN'),
        'secret' => env('MAILGUN_SECRET'),
    ],

    'ses' => [
        'key' => env('SES_KEY'),
        'secret' => env('SES_SECRET'),
        'region' => 'us-east-1',
    ],

    'sparkpost' => [
        'secret' => env('SPARKPOST_SECRET'),
    ],

    'stripe' => [
        'model' => App\User::class,
        'key' => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),
    ],

];

Remove mandrill as a default configuration since it's fallen out of popularity.


<?php

/**
* # Page View Model
*
* Automaticly load page based on slug, throw 404 if page doesn't exist.
*
* @package		Flatfile
* @category		View Model
* @author		Ziopod <ziopod@gmail.com>
* @copyright	(c) 2013-2014 Ziopod
* @license		http://opensource.org/licenses/MIT
**/

class Flatfile_View_Page extends View_App{

	/**
	* @var	object	Flafile page object
	**/
	public $page;

	public function __construct()
	{
		// Try to load Flatfile
		try
		{
			$this->page = new Model_Page(Request::initial()->param('slug'));
		}
		catch (Kohana_Exception $e)
		{
			throw HTTP_Exception::factory(404, __("Unable to find URI :uri"), array(':uri' => Request::initial()->uri()	));
		}

		$this->author = $this->page->author;
		$this->license = $this->page->license;
		$this->description = $this->page->description;
	}
}

<?php

/**
* # Page View Model
*
* Automaticly load page based on slug, throw 404 if page doesn't exist.
*
* @package		Flatfile
* @category		View Model
* @author		Ziopod <ziopod@gmail.com>
* @copyright	(c) 2013-2014 Ziopod
* @license		http://opensource.org/licenses/MIT
**/

class Flatfile_View_Page extends View_App{

	/**
	* @var	object	Flafile page object
	**/
	public $page;

	public function __construct()
	{
		// Try to load Flatfile
		try
		{
			$this->page = new Model_Page(Request::initial()->param('slug'));
		}
		catch (Kohana_Exception $e)
		{
			throw HTTP_Exception::factory(404, __("Unable to find URI :uri"), array(':uri' => Request::initial()->uri()	));
		}

		$this->title = $this->page->title;
		$this->author = $this->page->author;
		$this->license = $this->page->license;
		$this->description = $this->page->description;
	}
}

Add title var for template

Add title var for template


<?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.
 */

use Symfony\Polyfill\Php54 as p;

if (PHP_VERSION_ID < 50400) {
    if (!function_exists('trait_exists')) {
        function trait_exists($class, $autoload = true) { return $autoload && \class_exists($class, $autoload) && false; }
    }
    if (!function_exists('class_uses')) {
        function class_uses($class, $autoload = true)
        {
            if (\is_object($class) || \class_exists($class, $autoload) || \interface_exists($class, false)) {
                return array();
            }

            return false;
        }
    }
    if (!function_exists('hex2bin')) {
        function hex2bin($data) { return p\Php54::hex2bin($data); }
    }
    if (!function_exists('session_register_shutdown')) {
        function session_register_shutdown() { register_shutdown_function('session_write_close'); }
    }
}

<?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.
 */

use Symfony\Polyfill\Php54 as p;

if (PHP_VERSION_ID >= 50400) {
    return;
}

if (!function_exists('trait_exists')) {
    function trait_exists($class, $autoload = true) { return $autoload && \class_exists($class, $autoload) && false; }
}
if (!function_exists('class_uses')) {
    function class_uses($class, $autoload = true)
    {
        if (\is_object($class) || \class_exists($class, $autoload) || \interface_exists($class, false)) {
            return array();
        }

        return false;
    }
}
if (!function_exists('hex2bin')) {
    function hex2bin($data) { return p\Php54::hex2bin($data); }
}
if (!function_exists('session_register_shutdown')) {
    function session_register_shutdown() { register_shutdown_function('session_write_close'); }
}

Fix declaring extra constants when `intl` is loaded


<?php
class hash extends Script
{
    protected $availableAlgos;
    protected $helpMessage = 'Returns a hash of the given string, hashed with the given algorithm';

    function __construct($message, $matches, $waConnection)
	{
        $this->availableAlgos = hash_algos();
		$this->matches = $matches;
		$this->message = $message;
		$this->waConnection = $waConnection;
	}

    public function run()
    {
        if(!in_array(strtolower($this->matches[1]), $this->availableAlgos)) {
            $this->response = $this->matches[1] . " is not supported!\n";
            $this->response .= "Available algorithms:\n";

            foreach ($this->availableAlgos as $value) {
                $this->response .= $value . "\n";
            }

            return $this->send($this->response);
        } else {
            return $this->send(hash($this->matches[1], $this->matches[2]));
        }
    }

    function __destruct()
    {

    }
}

<?php
class hash extends Script
{
    protected $availableAlgos;
    protected $helpMessage = "hash ALGORITHM STRING";
    protected $description = 'Returns the hash of the given string, hashed with the given algorithm';

    function __construct($message, $matches, $waConnection)
	{
        $this->availableAlgos = hash_algos();
		$this->matches = $matches;
		$this->message = $message;
		$this->waConnection = $waConnection;
	}

    public function run()
    {
        if(!in_array(strtolower($this->matches[1]), $this->availableAlgos)) {
            $this->response = $this->matches[1] . " is not supported!\n";
            $this->response .= "Available algorithms:\n";

            foreach ($this->availableAlgos as $value) {
                $this->response .= $value . "\n";
            }

            return $this->send($this->response);
        } else {
            return $this->send(hash($this->matches[1], $this->matches[2]));
        }
    }

    function __destruct()
    {

    }
}

Complete the information for the help-plugin


<?php

  get_template_part('templates/page', 'header'); ?>

 <?
      while (have_posts()) : the_post(); ?>
        <li class="realisation-<?= basename(get_permalink()) ?>" style="background-image: url('<?= get_the_thumbnail_url() ?>')">
          <a href="<?= get_permalink() ?>">
            <?= $post->post_title ?>

 <?
      endwhile; ?>

Fix bug on Realisations blocks

Fix bug on Realisations blocks


<?php

namespace Kanbanize\Service;

use Kanbanize\Entity\KanbanizeTask;

interface KanbanizeService {

	//public function moveTask(KanbanizeTask $kanbanizeTask, $status);

	public function createNewTask($projectId, $taskSubject, $boardId);

	public function deleteTask(KanbanizeTask $kanbanizeTask);

	public function getTasks($boardId, $status = null);

	public function acceptTask(KanbanizeTask $task);

	public function executeTask(KanbanizeTask $kanbanizeTask);

	public function completeTask(KanbanizeTask $task);

	public function closeTask(KanbanizeTask $task);
}

<?php

namespace Kanbanize\Service;

use Kanbanize\Entity\KanbanizeTask;

interface KanbanizeService {

	//public function moveTask(KanbanizeTask $kanbanizeTask, $status);

	public function createNewTask($projectId, $taskSubject, $boardId);

	public function deleteTask(KTask $kanbanizeTask);

	public function getTasks($boardId, $status = null);

	public function acceptTask(KTask $task);

	public function executeTask(KTask $kanbanizeTask);

	public function completeTask(KTask $task);

	public function closeTask(KTask $task);
}

Fix Kanbanize Service use conflicts

Fix Kanbanize Service use conflicts


<?php

namespace Dan\Irc\Location;

use Dan\Irc\Connection;
use Dan\Irc\Traits\Mode;

abstract class Location
{
    use Mode;

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

    /**
     * @var Connection
     */
    protected $connection;

    /**
     * @param $message
     * @param array $styles
     *
     * @throws \Exception
     */
    public function message($message, $styles = [])
    {
        $this->connection->message($this, $message, $styles);
    }

    /**
     * @param $message
     */
    public function notice($message)
    {
        $this->connection->notice($this, $message);
    }

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

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

<?php

namespace Dan\Irc\Location;

use Dan\Irc\Connection;
use Dan\Irc\Traits\Mode;

abstract class Location
{
    use Mode;

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

    /**
     * @var Connection
     */
    protected $connection;

    /**
     * Sends a message to the location.
     *
     * @param $message
     * @param array $styles
     *
     * @throws \Exception
     */
    public function message($message, $styles = [])
    {
        $this->connection->message($this, $message, $styles);
    }

    /**
     * Sends an action to the location.
     *
     * @param $message
     * @param array $styles
     */
    public function action($message, $styles = [])
    {
        $this->connection->action($this, $message, $styles);
    }

    /**
     * Sends a notice to the location
     *
     * @param $message
     */
    public function notice($message)
    {
        $this->connection->notice($this, $message);
    }

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

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

Add action to the location object

Add action to the location object