<?php

namespace jvwp\components;

use fieldwork\components\Textarea;

/**
 * Fieldwork Field implementation of the wp_editor function
 */
class WpEditorField extends Textarea
{

    private $editorOptions = [];

    const OPTION_EDITOR_CLASS     = 'editor_class';
    const OPTION_DRAG_DROP_UPLOAD = 'drag_drop_upload';
    const OPTION_WPAUTOP          = 'wpautop';

    public function getHTML ($showLabel = true)
    {
        // Capture the output of the WordPress API function using output buffering
        ob_start();
        wp_editor($this->value, $this->getName(), $this->getEditorOptions());
        return ob_get_clean();
    }

    public function setOption ($option, $value)
    {
        $this->editorOptions[$option] = $value;
    }

    /**
     * Gets an array of options passed to
wp_editor

     * @return array
     */
    private function getEditorOptions ()
    {
        return array_merge([
            self::OPTION_EDITOR_CLASS     => implode(' ', $this->getClasses()),
            self::OPTION_DRAG_DROP_UPLOAD => true
        ], $this->editorOptions);
    }
}

<?php

namespace jvwp\components;

use fieldwork\components\Textarea;

/**
 * Fieldwork Field implementation of the wp_editor function
 */
class WpEditorField extends Textarea
{

    private $editorOptions = [];

    const OPTION_EDITOR_CLASS     = 'editor_class';
    const OPTION_DRAG_DROP_UPLOAD = 'drag_drop_upload';
    const OPTION_WPAUTOP          = 'wpautop';
    const OPTION_TEENY            = 'teeny';

    public function getHTML ($showLabel = true)
    {
        // Capture the output of the WordPress API function using output buffering
        ob_start();
        wp_editor($this->value, $this->getName(), $this->getEditorOptions());
        return ob_get_clean();
    }

    public function setOption ($option, $value)
    {
        $this->editorOptions[$option] = $value;
    }

    /**
     * Gets an array of options passed to
wp_editor

     * @return array
     */
    private function getEditorOptions ()
    {
        return array_merge([
            self::OPTION_EDITOR_CLASS     => implode(' ', $this->getClasses()),
            self::OPTION_DRAG_DROP_UPLOAD => true
        ], $this->editorOptions);
    }
}

Add the "teeny" wp editor option key

Add the "teeny" wp editor option key


<?php
namespace MicroFW\Core;

use MicroFW\Http\Request, MicroFW\Http\Response;

class Application
{
    /**
     * Start and setup the framework
     *
     * @return void
     */
    public static function setup()
    {
        $request = new Request();
        $response = new Response('Hello everyone!');

        echo($response->getContent());
    }
}

<?php
namespace MicroFW\Core;

use MicroFW\Http\Request, MicroFW\Http\Response, MicroFW\Core\Configurator;

class Application
{
    /**
     * Start and setup the framework
     *
     * @return void
     */
    public static function setup($projectPath)
    {
        $configurator = Configurator::createConfigurator($projectPath);
        $request = new Request($configurator);
        $response = new Response('Hello everyone!');

        echo($response->getContent());
    }
}

Call method for creating configurator

Call method for creating configurator

Configurator will be available in request object


<?php

/* vim: set noexpandtab tabstop=4 shiftwidth=4 foldmethod=marker: */

require_once 'Swat/SwatFrame.php';
require_once 'Swat/SwatReplicableContainer.php';

/**
 * A form field container that replicates its children
 *
 * The form field can dynamically create widgets based on an array of
 * replicators identifiers.
 *
 * @package   Swat
 * @copyright 2005-2006 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatReplicableFrame extends SwatReplicableContainer
{
	// {{{ protected function getContainer()

	/**
	 * Gets a container to contain replicated widgets for this replicable
	 * container
	 *
	 * @param string $id the replicator id for the container.
	 * @param stirng $title the title of the container. The container may or
	 *                       may not use this title.
	 *
	 * @return SwatContainer the container object to which replciated widgets
	 *                        are added. The container is added to the widget
	 *                        tree after adding the replicated widgets to the
	 *                        container. If null is returned, the widgets are
	 *                        replicated directly in the widget tree.
	 */
	protected function getContainer($id, $title)
	{
		$form_field = new SwatFrame();
		$form_field->title = $title;
		return $form_field;
	}

	// }}}
}

?>

<?php

/* vim: set noexpandtab tabstop=4 shiftwidth=4 foldmethod=marker: */

require_once 'Swat/SwatFrame.php';
require_once 'Swat/SwatReplicableContainer.php';

/**
 * A framer that replicates its children
 *
 * The frame can dynamically create widgets based on an array of
 * replicators identifiers.
 *
 * @package   Swat
 * @copyright 2005-2006 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatReplicableFrame extends SwatReplicableContainer
{
	// {{{ protected function getContainer()

	/**
	 * Gets a container to contain replicated widgets for this replicable
	 * container
	 *
	 * @param string $id the replicator id for the container.
	 * @param stirng $title the title of the container. The container may or
	 *                       may not use this title.
	 *
	 * @return SwatContainer the container object to which replciated widgets
	 *                        are added. The container is added to the widget
	 *                        tree after adding the replicated widgets to the
	 *                        container. If null is returned, the widgets are
	 *                        replicated directly in the widget tree.
	 */
	protected function getContainer($id, $title)
	{
		$frame = new SwatFrame();
		$frame->title = $title;
		return $frame;
	}

	// }}}
}

?>

Fix documentation and variable names.

Fix documentation and variable names.

svn commit r29747


<?php

// Setup I18N
require_once "../src/Core/I18N.php";
require_once "setup_i18n.php";

<?php

// Setup I18N before autoload to prevent Laravel helpers from overriding translation function __()
// These two lines must be before autoload.php
require_once (__DIR__."../src/Core/I18N.php");
require_once (__DIR__."setup_i18n.php");

Fix require path to i18n

Fix require path to i18n


<?php

namespace Kunstmaan\AdminBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
	/**
	 * @Route("/", name="KunstmaanAdminBundle_homepage")
	 * @Template()
	 */
    public function indexAction()
    {
        return $this->redirect($this->generateUrl("KunstmaanAdminBundle_pages"));;
    }
}

<?php

namespace Kunstmaan\AdminBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
	/**
	 * @Route("/", name="KunstmaanAdminBundle_homepage")
	 * @Template()
	 */
    public function indexAction()
    {
        return array();
    }
}

Fix for default index, this shouldn't be the pages overview


<?php if (isset($this->params['css']) && ($this->params['css'] !== false)): ?>
[?php use_stylesheet('<?php echo $this->params['css'] ?>', 'first') ?]
<?php endif; ?>

<?php if (isset($this->params['css']) && ($this->params['css'] !== false)): ?>
[?php use_stylesheet('<?php echo $this->params['css'] ?>', 'first'); ?]
<?php endif; ?>

[?php use_javascript('/sfBootstrapPropelAdminThemePlugin/js/theme.js', 'last'); ?]

Load theme.js in module assets

Load theme.js in module assets


<?php

namespace Liip\RD\Action;

class VcsPublishAction extends BaseAction
{
    public function execute($context)
    {
        $context->getService('vcs')->publishTag(
            $context->getService('vcs')->getTagFromVersion(
                $context->getParam('new-version')
            )
        );
        $context->getService('vcs')->publishChanges();
        $this->confirmSuccess($context);
    }
}

<?php

namespace Liip\RD\Action;

use Liip\RD\Information\InformationRequest;

class VcsPublishAction extends BaseAction
{
    public function execute($context)
    {
        $context->getService('vcs')->publishTag(
            $context->getService('version-persister')->getTagFromVersion(
                $context->getParam('new-version')
            )
        );
        $context->getService('vcs')->publishChanges();
        $this->confirmSuccess($context);
    }

    public function getInformationRequests()
    {
        return array(
            new InformationRequest('auto-publish', array(
                'description' => 'Automatically publish the change',
                'type' => 'boolean',
                'interactive' => true,
                'default' => false
            ))
        );
    }
}

Add a comfirmation on the auto publish action


<?php namespace Limoncello\Contracts\Application;

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

use Limoncello\Contracts\Routing\GroupInterface;

/**
 * @package Limoncello\Application
 */
interface RoutesConfiguratorInterface
{
    /**
     * @return string[]
     */
    public static function getMiddleware(): array;

    /**
     * @param GroupInterface $routes
     *
     * @return void
     */
    public static function configureRoutes(GroupInterface $routes);
}

<?php namespace Limoncello\Contracts\Application;

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

use Limoncello\Contracts\Routing\GroupInterface;

/**
 * @package Limoncello\Application
 */
interface RoutesConfiguratorInterface
{
    /**
     * Configurator's method name.
     */
    const METHOD_NAME = 'configureRoutes';

    /**
     * @return string[]
     */
    public static function getMiddleware(): array;

    /**
     * @param GroupInterface $routes
     *
     * @return void
     */
    public static function configureRoutes(GroupInterface $routes);
}

Add const for configurator method name.

Add const for configurator method name.


<?php

namespace UoMCS\OpenBadges\Backend;

class UtilityTest extends \PHPUnit_Framework_TestCase
{
  public function testIdentityHashSalt()
  {
    $str = 'test';
    $salt = 'salty';
    $hash = 'sha512$8d8e45e4dfcee6c5c0248d33717d87a3988817246db4f200b89bda0070444fd8f435638db28e6a8d0b2ce3d9d338c5871cf0f203f37ff678ac2a92a3cca6acd3';

    $this->assertEquals($hash, Utility::identityHash($str, $salt));
  }

  public function testIdentityHashNoSalt()
  {
    $str = 'test';
    $hash = 'sha512$ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff';

    $this->assertEquals($hash, Utility::identityHash($str));
  }
}

<?php

namespace UoMCS\OpenBadges\Backend;

class UtilityTest extends \PHPUnit_Framework_TestCase
{
  const HASH_ALGORITHM = 'sha512';

  public function testIdentityHashSalt()
  {
    $str = 'test';
    $salt = 'salty';
    $hash = '8d8e45e4dfcee6c5c0248d33717d87a3988817246db4f200b89bda0070444fd8f435638db28e6a8d0b2ce3d9d338c5871cf0f203f37ff678ac2a92a3cca6acd3';
    $hash = self::HASH_ALGORITHM . '$' . $hash;

    $this->assertEquals($hash, Utility::identityHash($str, $salt));
  }

  public function testIdentityHashNoSalt()
  {
    $str = 'test';
    $hash = 'ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff';
    $hash = self::HASH_ALGORITHM . '$' . $hash;

    $this->assertEquals($hash, Utility::identityHash($str));
  }
}

Move hash algorithm to class constant

Move hash algorithm to class constant

This change makes the tests a bit more readable.


<?php

require_once __DIR__ . '/Zigra/Core.php';
/**
 * This class only exists for backwards compatability. All code was moved to
 * Zigra_Core and this class extends Zigra_Core
 *
 * @author  Manuel Dalla Lana <endelwar@aregar.it>
 * @license Proprietary
 * @since   0.1.0
 */
class Zigra extends Zigra_Core
{
    const VERSION = '0.7.5';
}

<?php

require_once __DIR__ . '/Zigra/Core.php';
/**
 * This class only exists for backwards compatability. All code was moved to
 * Zigra_Core and this class extends Zigra_Core
 *
 * @author  Manuel Dalla Lana <endelwar@aregar.it>
 * @license Proprietary
 * @since   0.1.0
 */
class Zigra extends Zigra_Core
{
    const VERSION = '0.8.0';
}

Set release version to 0.8.0

Set release version to 0.8.0


<?php
namespace Matthew\WallPostBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;

class DefaultControllerTest extends WebTestCase
{

    public function testIndexAction()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/');

        $this->assertEquals(Response::HTTP_OK, $client->getResponse()
            ->getStatusCode());
    }

    public function testForm()
    {
        $client = static::createClient();

        $crawler = $client->request('POST', '/create', [
            'wallpost[title]' => 'Some Valid Title',
            'wallpost[author]' => 'Matthew',
            'wallpost[body]' => 'Body context',
        ]);

        $this->assertEquals(302, $client->getResponse()->getStatusCode());
    }

    public function testCreateActionWithFailingValidation() {

    }
}

<?php
namespace Matthew\WallPostBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;

class DefaultControllerTest extends WebTestCase
{

    public function testIndexAction()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/');

        $this->assertEquals(Response::HTTP_OK, $client->getResponse()
            ->getStatusCode());
    }

    public function testForm()
    {
        $client = static::createClient();

        $crawler = $client->request('POST', '/create', [
            'wallpost[title]' => 'Some Valid Title',
            'wallpost[author]' => 'Matthew',
            'wallpost[body]' => 'Body context'
        ]);

        $this->assertEquals(302, $client->getResponse()
            ->getStatusCode());
    }

    public function testCreateActionWithFailingValidation()
    {
        $client = static::createClient();
        $crawler = $client->request('POST', '/create', [
            'wallpost[title]' => 'Invalid',
            'wallpost[author]' => null,
            'wallpost[body]' => 'Body context'
        ]);

        $this->assertEquals(302, $client->getResponse()
            ->getStatusCode());
    }
}

Add final assertion to make sure invalid forms still post success


<?php

namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_20;

use Doctrine\DBAL\Schema\Schema;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
use Oro\Bundle\MigrationBundle\Migration\SqlMigrationQuery;

class OroEmailBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        self::oroEmailTable($schema);
        $this->deleteBodySyncProcess($queries);
    }

    /**
     * @param Schema $schema
     */
    public static function oroEmailTable(Schema $schema)
    {
        $table = $schema->getTable('oro_email');
        if (!$table->hasColumn('body_synced')) {
            $table->addColumn('body_synced', 'boolean', ['notnull' => false, 'default' => false]);
        }
    }

    /**
     * Delete sync_email_body_after_email_synchronize process definition
     *
     * @param QueryBag $queries
     */
    protected function deleteBodySyncProcess(QueryBag $queries)
    {
        $sql = <<<SQL
    DELETE
    FROM
      oro_process_definition
    WHERE name = 'sync_email_body_after_email_synchronize'
SQL;
        $queries->addPostQuery(new SqlMigrationQuery($sql));
    }
}

<?php

namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_20;

use Doctrine\DBAL\Schema\Schema;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\ParametrizedSqlMigrationQuery;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
use Oro\Bundle\MigrationBundle\Migration\SqlMigrationQuery;

class OroEmailBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        self::oroEmailTable($schema);
        $this->deleteBodySyncProcess($queries);
    }

    /**
     * @param Schema $schema
     */
    public static function oroEmailTable(Schema $schema)
    {
        $table = $schema->getTable('oro_email');
        if (!$table->hasColumn('body_synced')) {
            $table->addColumn('body_synced', 'boolean', ['notnull' => false, 'default' => false]);
        }
    }

    /**
     * Delete sync_email_body_after_email_synchronize process definition
     *
     * @param QueryBag $queries
     */
    protected function deleteBodySyncProcess(QueryBag $queries)
    {
        $queries->addQuery(
            new ParametrizedSqlMigrationQuery(
                'DELETE FROM oro_process_definition WHERE name = :processName',
                ['processName' => 'sync_email_body_after_email_synchronize']
            )
        );
    }
}

CRM-4904: Refactor email body sync
 - Refactor migration


<?php

    require $_SERVER['DOCUMENT_ROOT'] . '/../backend/outputObject.php';
    require $_SERVER['DOCUMENT_ROOT'] . '/../backend/databaseOptions.php';

    $id = $_GET['id'];
    $output = new JsonOutput('v2');

    if ($id != '') {

        // Get dog by its ID
        $dog = getSpecificDog($id);
        $dogArray = array($dog);
        if ($dog->id != $id) {
            $dogArray = array();
            $output = new JsonOutput('v2');
            $output->error = 'ID not found';
        }
    }
    else {

        // They want a random dog - check limits
        $dogArray = array();

        // They specified a limit
        $limitStr = $_GET['limit'];
        if ($limitStr != '') {
            $limit = intval($limitStr);

            // Make sure it's between 20 and 1
            if ($limit > 20) {
                $limit = 20;
            }
            else if ($limit < 1) {
                $limit = 1;
            }
        }
        else {

            // No limit specified - set default
            $limit = 1;
        }

        // For each i before limit, add to array.
        for ($i = 1; $i <= $limit; $i++) {
            $dog = getRandomDog();
            array_push($dogArray, $dog);
        }
    }

    $output->fromDogList($dogArray);
    echo $output->jsonify();

?>

<?php

    require $_SERVER['DOCUMENT_ROOT'] . '/../backend/outputObject.php';
    require $_SERVER['DOCUMENT_ROOT'] . '/../backend/databaseOptions.php';

    $id = $_GET['id'];
    $output = new JsonOutput('v2');

    if ($id != '') {

        // Get dog by its ID
        $dog = getSpecificDog($id);
        $dogArray = array($dog);
        if ($dog->id != $id) {
            $dogArray = array();
            $output = new JsonOutput('v2');
            $output->error = 'ID not found';
            $output->response_code = 404;
        }
    }
    else {

        // They want a random dog - check limits
        $dogArray = array();

        // They specified a limit
        $limitStr = $_GET['limit'];
        if ($limitStr != '') {
            $limit = intval($limitStr);

            // Make sure it's between 20 and 1
            if ($limit > 20) {
                $limit = 20;
            }
            else if ($limit < 1) {
                $limit = 1;
            }
        }
        else {

            // No limit specified - set default
            $limit = 1;
        }

        // For each i before limit, add to array.
        for ($i = 1; $i <= $limit; $i++) {
            $dog = getRandomDog();
            array_push($dogArray, $dog);
        }
    }

    $output->fromDogList($dogArray);
    echo $output->jsonify();

?>

Add correct response code for error

Add correct response code for error

404 not 200 c:


<?php
/**
 * Created by PhpStorm.
 * User: d.baudry
 * Date: 12/10/2017
 * Time: 16:12
 */

namespace GameScoreBundle\Service;

use UserBundle\Entity\User;

class LoadPageLogWriter
{
    public function test(\DateTime $date, User $user)
    {
        $logFilePath = '..\web\files\homepage_loads.txt';
        $logData = $date->format('Y-m-d H:i:s')
            . ' : '
            .'Home visited'
            . ' : '
            . $user->getUsername() . ' (id:' . $user->getId() .')'
            . PHP_EOL;
        file_put_contents($logFilePath, $logData, FILE_APPEND | LOCK_EX);
    }
}

<?php
/**
 * Created by PhpStorm.
 * User: d.baudry
 * Date: 12/10/2017
 * Time: 16:12
 */

namespace GameScoreBundle\Service;

use UserBundle\Entity\User;

class LoadPageLogWriter
{
    public function test(\DateTime $date, $user)
    {
        if ($user) {
            $userId = $user->getId();
            $userName = $user->getUsername();
        } else {
            $userId = 0;
            $userName = 'Anonymous';
        }
        $logFilePath = '..\web\files\homepage_loads.txt';
        $logData = $date->format('Y-m-d H:i:s')
            . ' : '
            .'Home visited'
            . ' : '
            . $userName . ' (id:' . $userId .')'
            . PHP_EOL;
        file_put_contents($logFilePath, $logData, FILE_APPEND | LOCK_EX);
    }
}

Allow anonymous on loadpage service

Allow anonymous on loadpage service


<?php

namespace actsmart\actsmart\Stores;

use actsmart\actsmart\Conversations\Conversation;
use actsmart\actsmart\Sensors\UtteranceEvent;
use actsmart\actsmart\Interpreters\Intent;
use actsmart\actsmart\Sensors\SensorEvent;

interface ConversationTemplateStoreInterface
{

    /**
     * @param Conversation $conversation
     */
    public function addConversation(Conversation $conversation);

    /**
     * @param array $conversations
     */
    public function addConversations($conversations);

    /**
     * @param $conversation_template_id
     * @return Conversation
     */
    public function getConversation($conversation_template_id);

    /**
     * Returns the set of conversations whose opening utterance has an intent that
     * matches the $intent.
     *
     * @param Intent $intent
     * @return array | boolean
     */
    public function getMatchingConversations(UtteranceEvent $e, Intent $intent);

    /**
     * Returns a single match - the first conversation that matchs for now.
     *
     * @todo This should become more sophisticated than simply return the first
     * conversation.
     *
     * @param Intent $intent
     * @return mixed
     */
    public function getMatchingConversation(SensorEvent $e, Intent $intent);

    /**
     * Creates the conversations objects this store will deal with.
     * @return mixed
     */
    public function buildConversations();
}

<?php

namespace actsmart\actsmart\Stores;

use actsmart\actsmart\Conversations\Conversation;
use actsmart\actsmart\Sensors\UtteranceEvent;
use actsmart\actsmart\Interpreters\Intent;
use actsmart\actsmart\Sensors\SensorEvent;

interface ConversationTemplateStoreInterface
{

    /**
     * @param Conversation $conversation
     */
    public function addConversation(Conversation $conversation);

    /**
     * @param array $conversations
     */
    public function addConversations($conversations);

    /**
     * @param $conversation_template_id
     * @return Conversation
     */
    public function getConversation($conversation_template_id);

    /**
     * Returns the set of conversations whose opening utterance has an intent that
     * matches the $intent.
     *
     * @param Intent $intent
     * @return array | boolean
     */
    public function getMatchingConversations(SensorEvent $e, Intent $intent);

    /**
     * Returns a single match - the first conversation that matchs for now.
     *
     * @todo This should become more sophisticated than simply return the first
     * conversation.
     *
     * @param Intent $intent
     * @return mixed
     */
    public function getMatchingConversation(SensorEvent $e, Intent $intent);

    /**
     * Creates the conversations objects this store will deal with.
     * @return mixed
     */
    public function buildConversations();
}

Use more generic event class.

Use more generic event class.


<?php
/**
 * @author Jonathan Oddy <jonathan@moo.com>
 * @copyright Copyright (c) 2012, Moo Print Ltd.
 * @license ISC
 */
namespace Weasel\JsonMarshaller\Config\Serialization;
use Weasel\JsonMarshaller\Config\DoctrineAnnotations\JsonProperty;
use Weasel\JsonMarshaller\Config\DoctrineAnnotations\JsonTypeName;

/**
 * Class GetterSerialization
 * @package Weasel\JsonMarshaller\Config\Serialization
 * @JsonTypeName("getter")
 */
class GetterSerialization extends PropertySerialization
{

    /**
     * @var string
     * @JsonProperty(type="method")
     */
    public $method;

    function __construct($method = null, $type = null, $include = null, $typeInfo = null)
    {
        $this->method = $method;
        $this->include = $include;
        $this->type = $type;
        $this->typeInfo = $typeInfo;
    }

    public function __toString()
    {
        return "[GetterSerialization method={$this->method} include={$this->include} type={$this->type} typeInfo={$this->typeInfo}]";
    }

}

<?php
/**
 * @author Jonathan Oddy <jonathan@moo.com>
 * @copyright Copyright (c) 2012, Moo Print Ltd.
 * @license ISC
 */
namespace Weasel\JsonMarshaller\Config\Serialization;
use Weasel\JsonMarshaller\Config\DoctrineAnnotations\JsonProperty;
use Weasel\JsonMarshaller\Config\DoctrineAnnotations\JsonTypeName;

/**
 * Class GetterSerialization
 * @package Weasel\JsonMarshaller\Config\Serialization
 * @JsonTypeName("getter")
 */
class GetterSerialization extends PropertySerialization
{

    /**
     * @var string
     * @JsonProperty(type="string")
     */
    public $method;

    function __construct($method = null, $type = null, $include = null, $typeInfo = null)
    {
        $this->method = $method;
        $this->include = $include;
        $this->type = $type;
        $this->typeInfo = $typeInfo;
    }

    public function __toString()
    {
        return "[GetterSerialization method={$this->method} include={$this->include} type={$this->type} typeInfo={$this->typeInfo}]";
    }

}

Fix typo of Weasel type.

Fix typo of Weasel type.


<?php
// Cheatsheet: https://andreiabohner.files.wordpress.com/2014/06/slim.pdf
if(in_array($app->request->getContentType(), array("application/json", "application/xml"))) {
    // Add the request to the request bucket
    $reqMD5 = md5("pageRequests" . $app->request->getIp());
    $app->Cache->increment($reqMD5, 1, 60);
    $pageRequests = $app->Cache->get($reqMD5);
    $maxApiRequestsAllowedPrMinute = $app->baseConfig->getConfig("apiRequestsPrMinute", "site", 1800);
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Methods: GET, POST");
    header("X-Bin-Request-Count: $pageRequests");
    header("X-Bin-Max-Requests-Min: $maxApiRequestsAllowedPrMinute");
    header("X-Bin-Max-Requests-Sec: " . $maxApiRequestsAllowedPrMinute / 60);

    // Someone hit the rate limit for the api, lets tell em to chillax
    if ($pageRequests >= $maxApiRequestsAllowedPrMinute) {
        render("", array("error" => "max requests hit, please consult the headers for how many requests you can do a minute, and how many you've done."), 420, $app->request->getContentType() ? $app->request->getContentType() : "application/json");
        exit();
    }
}

// Include all routes from the routes directory
$routes = glob(__DIR__ . "/routes/*.php");
foreach ($routes as $route)
    require_once($route);

<?php
// Cheatsheet: https://andreiabohner.files.wordpress.com/2014/06/slim.pdf

// Include all routes from the routes directory
$routes = glob(__DIR__ . "/routes/*.php");
foreach ($routes as $route)
    require_once($route);

Remove the old scrape checker code that didn't even work in the first place


<?php

namespace duncan3dc\Twitter\Posts;

use duncan3dc\DomParser\HtmlParser;

class Php extends AbstractPost
{
    public $hostname = "http://news.php.net";
    public $avatar = "/images/php.png";

    public function __construct(array $row)
    {
        parent::__construct($row);

        $a = (new HtmlParser($this->data["description"]))->getTag("a");
        $email = $a->getAttribute("href");
        $email = str_replace("mailto:", "", $email);
        $email = str_replace("+dot+", ".", $email);
        $email = str_replace("+at+", "@", $email);
        $this->username = $email;
        $this->fullname = $a->nodeValue;
        $this->link = $this->data["link"];
    }

    public function getHtml()
    {
        return $this->data["title"] . "
data["link"] . "'>" . $this->data["link"] . "";
    }
}

<?php

namespace duncan3dc\Twitter\Posts;

use duncan3dc\DomParser\HtmlParser;

class Php extends AbstractPost
{
    public $hostname = "http://news.php.net";
    public $avatar = "/images/php.png";

    public function __construct(array $row)
    {
        parent::__construct($row);

        $a = (new HtmlParser($this->data["description"]))->getTag("a");
        if ($a) {
            $email = $a->getAttribute("href");
            $email = str_replace("mailto:", "", $email);
            $email = str_replace("+dot+", ".", $email);
            $email = str_replace("+at+", "@", $email);
            $this->username = $email;
            $this->fullname = $a->nodeValue;
        } else {
            $this->username = $this->data["description"];
            $this->fullname = $this->data["description"];
        }

        $this->link = $this->data["link"];
    }

    public function getHtml()
    {
        return $this->data["title"] . "
data["link"] . "'>" . $this->data["link"] . "";
    }
}

Handle posts with malformed email addresses


<?php
require 'vendor/autoload.php';

// Replace the path to *this* PHP file with the alias because the usage summary
// relies on this.
if ($argc > 0) {
    $argv[0] = "ff";
}

$client = new \phparsenal\fastforward\Client();
try {
    $client->init();
    $client->run($argv);
} catch (\Exception $e) {
    $client->getCLI()
        ->br()
        ->error('<bold>' . $e->getMessage() . '</bold>')
        ->error($e->getTraceAsString());
}

<?php
require __DIR__ . DIRECTORY_SEPARATOR . 'vendor/autoload.php';

// Replace the path to *this* PHP file with the alias because the usage summary
// relies on this.
if ($argc > 0) {
    $argv[0] = "ff";
}

$client = new \phparsenal\fastforward\Client();
try {
    $client->init();
    $client->run($argv);
} catch (\Exception $e) {
    $client->getCLI()
        ->br()
        ->error('<bold>' . $e->getMessage() . '</bold>')
        ->error($e->getTraceAsString());
}

Stop from using wrong auto loader

Stop from using wrong auto loader


<?php

namespace Tests\Concerns;

use PHPUnit\Framework\Assert;

class ArtisanResult
{
    private $output;
    private $status;
    private $parameters;

    public function __construct($parameters, $output, $status)
    {
        $this->output = $output;
        $this->status = $status;
        $this->parameters = $parameters;
    }

    public function assertStatus($expected)
    {
        Assert::assertEquals($expected, $this->status);
    }

    public function assertStepOutput($expectedLines)
    {
        foreach ($this->stepLines() as $index => $actualLine) {
            Assert::assertEquals($expectedLines[$index], $actualLine);
        }
    }

    public function dump()
    {
        return tap($this, function () {
            dump("Status: {$this->status}");
            dump("Output:\n{$this->output}");
        });
    }

    public function dumpIfFailed()
    {
        return $this->status === 0 ? $this : $this->dump();
    }

    private function outputLines()
    {
        foreach (explode("\n", $this->output) as $index => $actualLine) {
            yield $index => $actualLine;
        }
    }

    private function stepLines()
    {
        foreach ($this->outputLines() as $index => $actualLine) {
            if (substr($actualLine, 0, 1) !== "[") {
                break;
            }

            yield $index => $actualLine;
        }
    }
}

<?php

namespace Tests\Concerns;

use PHPUnit\Framework\Assert;

class ArtisanResult
{
    private $output;
    private $status;
    private $parameters;

    public function __construct($parameters, $output, $status)
    {
        $this->output = $output;
        $this->status = $status;
        $this->parameters = $parameters;
    }

    public function assertStatus($expected)
    {
        Assert::assertEquals($expected, $this->status);
    }

    public function assertStepOutput($expectedLines)
    {
        foreach ($this->stepLines() as $index => $actualLine) {
            Assert::assertEquals($expectedLines[$index], $actualLine);
        }
    }

    public function dump()
    {
        return tap($this, function () {
            dump("Status: {$this->status}");
            dump("Output:\n{$this->output}");
        });
    }

    public function dumpIfFailed()
    {
        return $this->status === 0 ? $this : $this->dump();
    }

    private function outputLines()
    {
        foreach (explode("\n", trim($this->output)) as $index => $actualLine) {
            yield $index => trim($actualLine);
        }
    }

    private function stepLines()
    {
        foreach ($this->outputLines() as $index => $actualLine) {
            if (substr($actualLine, 0, 1) !== "[") {
                break;
            }

            yield $index => $actualLine;
        }
    }
}

Trim output of each line

Trim output of each line


<?php

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

class AddLinkEnumToVisitsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("ALTER TABLE visits MODIFY resource_type ENUM('page','app','flow','link') NOT NULL DEFAULT 'page';");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::statement("ALTER TABLE visits MODIFY resource_type ENUM('page','app','flow') NOT NULL DEFAULT 'page';");
    }
}

<?php

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

class AddLinkEnumToVisitsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("ALTER TABLE visits MODIFY resource_type ENUM('page','app','workflow','link') NOT NULL DEFAULT 'page';");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::statement("ALTER TABLE visits MODIFY resource_type ENUM('page','app','flow') NOT NULL DEFAULT 'page';");
    }
}

Change flow to workflow in visits table migration


<?php

namespace ZfcUser\Mapper;

use Zend\Stdlib\Hydrator\ClassMethods;
use ZfcUser\Entity\UserInterface as UserEntityInterface;

class UserHydrator extends ClassMethods
{
    /**
     * Extract values from an object
     *
     * @param  object $object
     * @return array
     * @throws Exception\InvalidArgumentException
     */
    public function extract($object)
    {
        if (!$object instanceof UserEntityInterface) {
            throw new Exception\InvalidArgumentException('$object must be an instance of ZfcUser\Entity\UserInterface');
        }
        /* @var $object UserInterface*/
        $data = parent::extract($object);
        $data = $this->mapField('id', 'user_id', $data);
        return $data;
    }

    /**
     * Hydrate $object with the provided $data.
     *
     * @param  array $data
     * @param  object $object
     * @return UserInterface
     * @throws Exception\InvalidArgumentException
     */
    public function hydrate(array $data, $object)
    {
        if (!$object instanceof UserEntityInterface) {
            throw new Exception\InvalidArgumentException('$object must be an instance of ZfcUser\Entity\UserInterface');
        }
        $data = $this->mapField('user_id', 'id', $data);
        return parent::hydrate($data, $object);
    }

    protected function mapField($keyFrom, $keyTo, array $array)
    {
        $array[$keyTo] = $array[$keyFrom];
        unset($array[$keyFrom]);
        return $array;
    }
}

<?php

namespace ZfcUser\Mapper;

use Zend\Stdlib\Hydrator\ClassMethods;
use ZfcUser\Entity\UserInterface as UserEntityInterface;

class UserHydrator extends ClassMethods {

    /**
     * Extract values from an object
     *
     * @param  object $object
     * @return array
     * @throws Exception\InvalidArgumentException
     */
    public function extract($object) {
        if (!$object instanceof UserEntityInterface) {
            throw new Exception\InvalidArgumentException('$object must be an instance of ZfcUser\Entity\UserInterface');
        }
        /* @var $object UserInterface */
        $data = parent::extract($object);
        if ($data['id'] !== null) {
            $data = $this->mapField('id', 'user_id', $data);
        } else {
            unset($data['id']);
        }
        return $data;
    }

    /**
     * Hydrate $object with the provided $data.
     *
     * @param  array $data
     * @param  object $object
     * @return UserInterface
     * @throws Exception\InvalidArgumentException
     */
    public function hydrate(array $data, $object) {
        if (!$object instanceof UserEntityInterface) {
            throw new Exception\InvalidArgumentException('$object must be an instance of ZfcUser\Entity\UserInterface');
        }
        $data = $this->mapField('user_id', 'id', $data);
        return parent::hydrate($data, $object);
    }

    protected function mapField($keyFrom, $keyTo, array $array) {
        $array[$keyTo] = $array[$keyFrom];
        unset($array[$keyFrom]);
        return $array;
    }

}

Fix Null Id, on create user Postgresql

Fix Null Id, on create user  Postgresql


<html>
<head>
    <title>dit</title>
</head>
<body>
<pre>
    <?php
    # We do not background the call since we need it to finish before building.
    shell_exec('git pull >> ../build.log 2>&1');
    shell_exec('python ../dit/site/build.py ../public_html 5 >> ../build.log 2>&1 &');
    ?>
    Done.
</pre>
</body>
</html>

<html>
<head>
    <title>dit</title>
</head>
<body>
<pre>
    <?php
    # We do not background the call since we need it to finish before building.
    chdir('../dit');
    shell_exec('git pull >> ../build.log 2>&1');
    shell_exec('python site/build.py ../public_html 5 >> ../build.log 2>&1 &');
    ?>
    Done.
</pre>
</body>
</html>

Make sure php is in git repo.

Make sure php is in git repo.


Remove the missing script tag resource

Remove the missing script tag resource


<?php

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

namespace Symfony\Component\Cache\Adapter;

use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\CacheItem;

// Help opcache.preload discover always-needed symbols
class_exists(CacheItem::class);

/**
 * Interface for adapters managing instances of Symfony's CacheItem.
 *
 * @author Kévin Dunglas <dunglas@gmail.com>
 */
interface AdapterInterface extends CacheItemPoolInterface
{
    /**
     * {@inheritdoc}
     *
     * @return CacheItem
     */
    public function getItem($key);

    /**
     * {@inheritdoc}
     *
     * @return \Traversable|CacheItem[]
     */
    public function getItems(array $keys = []);

    /**
     * {@inheritdoc}
     *
     * @return bool
     */
    public function clear(string $prefix = '');
}

<?php

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

namespace Symfony\Component\Cache\Adapter;

use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\CacheItem;

// Help opcache.preload discover always-needed symbols
class_exists(CacheItem::class);

/**
 * Interface for adapters managing instances of Symfony's CacheItem.
 *
 * @author Kévin Dunglas <dunglas@gmail.com>
 */
interface AdapterInterface extends CacheItemPoolInterface
{
    /**
     * {@inheritdoc}
     *
     * @return CacheItem
     */
    public function getItem($key);

    /**
     * {@inheritdoc}
     *
     * @return \Traversable<string, CacheItem>
     */
    public function getItems(array $keys = []);

    /**
     * {@inheritdoc}
     *
     * @return bool
     */
    public function clear(string $prefix = '');
}

Add generic types to traversable implementations


<?php

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

class CreateReviewsTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('reviews', function(Blueprint $table)
        {
            $table->increments('id');
            $table->text('content');
            $table->string('author', 255)->nullable();
            $table->integer('rating');
            $table->integer('user_id');
            $table->integer('paper_id');
            $table->timestamp('created_at');
        });
    }

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

}

<?php

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

class CreateReviewsTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('reviews', function(Blueprint $table)
        {
            $table->increments('id');
            $table->text('content');
            $table->integer('rating');
            $table->integer('user_id');
            $table->integer('paper_id');
            $table->timestamp('created_at');
        });
    }

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

}

Remove author attr in reivew table(useless)


<?php

class FunctionTest extends PHPUnit_Framework_TestCase
{
    public function testReturnVoid()
    {
        $this->assertNull($this->returnNothing());
    }

    private function returnNothing() { ; }
}

<?php

class FunctionTest extends PHPUnit_Framework_TestCase
{
    public function testReturnVoid()
    {
        $this->assertNull($this->returnNothing());
    }

    public function testCall()
    {
        $ten = array($this,  'return10');
        $this->assertEquals(10, $ten());
    }

    private function returnNothing() { ; }
    private function return10() { return 10; }
}

Add a stupid test about function calling


<?php
/**
 * (c) Mantas Varatiejus <var.mantas@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace MVar\Apache2LogParser;

class KeysHolder
{
    /**
     * @var array
     */
    protected $storage;

    /**
     * Stores key to local storage and returns it's index
     *
     * @param string $namespace
     * @param string $key
     *
     * @return int Stored key index
     */
    public function add($namespace, $key)
    {
        $this->storage[$namespace][] = $key;

        return count($this->storage[$namespace]) - 1;
    }

    /**
     * Returns key from local storage
     *
     * @param string $namespace
     * @param int    $index
     *
     * @return string
     */
    public function get($namespace, $index)
    {
        // TODO: check if exists

        return $this->storage[$namespace][$index];
    }

    /**
     * Returns names of all stored namespaces
     *
     * @return array
     */
    public function getNamespaces()
    {
        return array_keys($this->storage);
    }
}

<?php
/**
 * (c) Mantas Varatiejus <var.mantas@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace MVar\Apache2LogParser;

class KeysHolder
{
    /**
     * @var array
     */
    protected $storage = array();

    /**
     * Stores key to local storage and returns it's index
     *
     * @param string $namespace
     * @param string $key
     *
     * @return int Stored key index
     */
    public function add($namespace, $key)
    {
        $this->storage[$namespace][] = $key;

        return count($this->storage[$namespace]) - 1;
    }

    /**
     * Returns key from local storage
     *
     * @param string $namespace
     * @param int    $index
     *
     * @return string
     */
    public function get($namespace, $index)
    {
        // TODO: check if exists

        return $this->storage[$namespace][$index];
    }

    /**
     * Returns names of all stored namespaces
     *
     * @return array
     */
    public function getNamespaces()
    {
        return array_keys($this->storage);
    }
}

Set default storage value otherwise getNamespaces() fails if nothing is set


<?php

	namespace vps\tools\console;

	/**
	 * @author    Anna Manaenkova <witzawitz@gmail.com>
	 * @copyright Copyright (c) 2017
	 * @date      2017-10-20
	 */
	class Application extends \yii\console\Application
	{
		protected $_nullComponents = [ 'migrate' => 'settings' ];

		public function __construct ($config = [])
		{
			$config = $this->filterConfig($config);
			parent::__construct($config);
		}

		private function filterConfig ($config)
		{
			$setNullComponents = false;

			// Remove unnecessary components for migrations.
			$argv = $_SERVER[ 'argv' ];
			$argc = $_SERVER[ 'argc' ];

			if ($argc > 1)
			{
				list($controller,) = explode("/", $argv[ 1 ]);
				if ($controller)
				{
					if (isset($this->_nullComponents[ $controller ]))
					{
						foreach ($this->_nullComponents[ $controller ] as $component)
						{
							if (isset($config[ 'components' ][ $component ]))
								$config[ 'components' ][ $component ] = null;
						}
					}
				}
			}

			return $config;
		}
	}

<?php

	namespace vps\tools\console;

	/**
	 * @author    Anna Manaenkova <witzawitz@gmail.com>
	 * @copyright Copyright (c) 2017
	 * @date      2017-10-20
	 */
	class Application extends \yii\console\Application
	{
		protected $_nullComponents = [ 'migrate' => [ 'settings' ] ];

		public function __construct ($config = [])
		{
			$config = $this->filterConfig($config);
			parent::__construct($config);
		}

		private function filterConfig ($config)
		{
			$setNullComponents = false;

			// Remove unnecessary components for migrations.
			$argv = $_SERVER[ 'argv' ];
			$argc = $_SERVER[ 'argc' ];

			if ($argc > 1)
			{
				list($controller,) = explode("/", $argv[ 1 ]);
				if ($controller)
				{
					if (isset($this->_nullComponents[ $controller ]))
					{
						foreach ($this->_nullComponents[ $controller ] as $component)
						{
							if (isset($config[ 'components' ][ $component ]))
								$config[ 'components' ][ $component ] = null;
						}
					}
				}
			}

			return $config;
		}
	}

Fix console app components ignore settings.


@extends('adminlte::layouts.app')

@section('htmlheader_title')
	{{ trans('adminlte_lang::message.home') }}
@endsection

@section('main-content')

Home

						{{ trans('adminlte_lang::message.logged') }}

@endsection

Fix grid styling to be contained in content block


<?php

class Stripe_ApiRequestorTest extends UnitTestCase
{
  public function testEncode()
  {
    $a = array('my' => 'value', 'that' => array('your' => 'example'), 'bar' => 1, 'baz' => null);
    $enc = Stripe_APIRequestor::encode($a);
    $this->assertEqual($enc, 'my=value&that%5Byour%5D=example&bar=1');
  }
}

<?php

class Stripe_ApiRequestorTest extends UnitTestCase
{
  public function testEncode()
  {
    $a = array('my' => 'value', 'that' => array('your' => 'example'), 'bar' => 1, 'baz' => null);
    $enc = Stripe_APIRequestor::encode($a);
    $this->assertEqual($enc, 'my=value&that%5Byour%5D=example&bar=1');

    $a = array('that' => array('your' => 'example', 'foo' => null));
    $enc = Stripe_APIRequestor::encode($a);
    $this->assertEqual($enc, 'that%5Byour%5D=example');
  }
}

Add test case for arrays with null values


<?php

namespace Backend\Modules\MediaLibrary\Domain\MediaGroup;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class SingleMediaGroupType extends MediaGroupType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $options['minimum_items'] = 1;
        $options['maximum_items'] = 1;

        parent::buildForm($builder, $options);
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        parent::configureOptions($resolver);
        $resolver->remove(
            [
                'minimum_items',
                'maximum_items',
            ]
        );
    }
}

<?php

namespace Backend\Modules\MediaLibrary\Domain\MediaGroup;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class SingleMediaGroupType extends MediaGroupType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        parent::buildForm($builder, $options);
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        parent::configureOptions($resolver);

        $resolver->setDefault('minimum_items', 1);
        $resolver->setDefault('maximum_items', 1);
    }
}

Fix single media group type not working in the view


<?php
namespace ET;

class Config
{
    private $config;

    public function __construct($configFile, $visitDomain)
    {
        // Config not  found at all
        if (!file_exists($configFile)) {
            throw new ConfigException('Configruation file not found: '.$configFile);
        }

        // Parse INI file
        $config = parse_ini_file($configFile, true);

        // Failed to parse, empty or no default domain specified
        if (!$config || !is_array($config['@'])) {
            throw new ConfigException('Configruation file failed to parse: '.$configFile);
        }

        // Set default-values and remove it from the list
        $this->config = $config['@'];
        unset($config['@']);

        //Exact matching of domain name will have priority and ignore all fuzzy matching
        if (isset($config[$visitDomain])) {
            foreach ($contents as $key => $value) {
                $this->config[$key] = $value;
            }
        } else {
            // Fuzzy match domain name with wildcards and run to the end of the array
            foreach ($config as $domain => $contents) {
                if (fnmatch($domain, $visitDomain)) {
                    foreach ($contents as $key => $value) {
                        if (!is_array($value)) {
                            $this->config[$key] = $value;
                        } else {
                            foreach ($value as $key2 => $value2) {
                                $this->config[$key][$key2] = $value2;
                            }
                        }
                    }
                }
            }
        }
    }
}

<?php
namespace ET;

class Config
{
    private $config;

    public function __construct($configFile, $visitDomain)
    {
        // Config not found at all
        if (!file_exists($configFile)) {
            throw new ConfigException('Configruation file not found: '.$configFile);
        }

        // Parse INI file
        $config = parse_ini_file($configFile, true);

        // Failed to parse, empty or no default domain specified
        if (!$config || !is_array($config['@'])) {
            throw new ConfigException('Configruation file failed to parse: '.$configFile);
        }

        // Set default-values and remove it from the list
        $this->config = $config['@'];
        unset($config['@']);

        //Exact matching of domain name will have priority and ignore all fuzzy matching
        if (isset($config[$visitDomain])) {
            foreach ($config[$visitDomain] as $key => $value) {
                if (!is_array($value)) {
                    $this->config[$key] = $value;
                } else {
                    foreach ($value as $key2 => $value2) {
                        $this->config[$key][$key2] = $value2;
                    }
                }
            }
        } else {
            // Fuzzy match domain name with wildcards and run to the end of the array
            foreach ($config as $domain => $contents) {
                if (fnmatch($domain, $visitDomain)) {
                    foreach ($contents as $key => $value) {
                        if (!is_array($value)) {
                            $this->config[$key] = $value;
                        } else {
                            foreach ($value as $key2 => $value2) {
                                $this->config[$key][$key2] = $value2;
                            }
                        }
                    }
                }
            }
        }
    }

    public function dumpConfig()
    {
        return $this->config;
    }
}

Fix issue with recursive arrays on exact matching domains, also added function to dump entire config


<?php namespace Clean\Repository\CacheAdapter;

use Clean\Repository\CacheAdapterInterface;
use Metaphore\Cache;

class Metaphore implements CacheAdapterInterface
{
    /**
     * @var Cache
     */
    private $backend;

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

    /**
     * @see CacheAdapterInterface::cache()
     */
    public function cache($key, callable $callable, $ttl)
    {
        return $this->backend->cache($key, $callable, $ttl);
    }
}

<?php namespace Clean\Repository\CacheAdapter;

use Clean\Repository\CacheAdapterInterface;
use Metaphore\Cache;

class Metaphore implements CacheAdapterInterface
{
    /**
     * @var Cache
     */
    private $backend;

    /**
     * @param Cache $backend
     */
    public function __construct(Cache $backend, $prefix = '')
    {
        $this->backend = $backend;
        $this->prefix = $prefix;
    }

    /**
     * @see CacheAdapterInterface::cache()
     */
    public function cache($key, callable $callable, $ttl)
    {
        return $this->backend->cache($this->prefix.$key, $callable, $ttl);
    }
}

Support for prefixing of cache keys

Support for prefixing of cache keys


<?php namespace Anomaly\ColorpickerFieldType\Handler;

use Anomaly\ColorpickerFieldType\ColorpickerFieldType;
use Anomaly\ColorpickerFieldType\Command\ParseColors;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Collection;

/**
 * Class DefaultHandler
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 * @package       Anomaly\ColorpickerFieldType\Handler
 */
class DefaultHandler
{

    use DispatchesJobs;

    /**
     * Handle the predefined colors.
     *
     * @param ColorpickerFieldType $fieldType
     */
    public function handle(ColorpickerFieldType $fieldType)
    {
        $colors = $fieldType->config('colors', []);

        if (is_string($colors)) {
            $colors = $this->dispatch(new ParseColors($colors));
        }

        $fieldType->setColors((array)$colors);
    }
}

<?php namespace Anomaly\ColorpickerFieldType\Handler;

use Anomaly\ColorpickerFieldType\ColorpickerFieldType;
use Anomaly\ColorpickerFieldType\Command\ParseColors;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Collection;

/**
 * Class DefaultHandler
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 * @package       Anomaly\ColorpickerFieldType\Handler
 */
class DefaultHandler
{

    use DispatchesJobs;

    /**
     * Handle the predefined colors.
     *
     * @param ColorpickerFieldType $fieldType
     */
    public function handle(ColorpickerFieldType $fieldType)
    {
        $colors = $fieldType->config('colors', []);

        if (is_string($colors)) {
            $colors = $this->dispatch(new ParseColors($colors));
        }

        if (is_array($colors) && count(array_filter(array_keys($colors), 'is_string')) == 0) {
            $colors = array_combine($colors, $colors);
        }

        $fieldType->setColors((array)$colors);
    }
}

Fix issue where hex titles were not automatically generated.


<?php

namespace Tests\Browser;

use Tests\DuskTestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class MicropubClientTest extends DuskTestCase
{
    /**
     * Test the client is shown for an unauthorised request.
     *
     * @return void
     */
    public function test_client_page_see_authenticated()
    {
        $this->browse(function ($browser) {
            $browser->visit('/micropub/create')
                    ->assertSee('You are authenticated');
        });
    }

    public function test_client_page_updates_syndication()
    {
        $this->browse(function ($browser) {
            $browser->visit(route('micropub-client'))
                    ->assertDontSee('jonnybarnes on Twitter')
                    ->clickLink('Refresh Syndication Targets')
                    ->pause(5000)
                    ->assertSee('jonnybarnes on Twitter');
        });
    }
}

<?php

namespace Tests\Browser;

use Tests\DuskTestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class MicropubClientTest extends DuskTestCase
{
    /**
     * Test the client is shown for an unauthorised request.
     *
     * @return void
     */
    public function test_client_page_see_authenticated()
    {
        $this->browse(function ($browser) {
            $browser->visit(route('micropub-client'))
                    ->assertSee('You are authenticated');
        });
    }

    public function test_client_page_creates_new_note()
    {
        $faker = \Faker\Factory::create();
        $note = 'Fake note from #LaravelDusk: ' . $faker->text;
        $this->browse(function ($browser) use ($note) {
            $browser->visit(route('micropub-client'))
                    ->type('content', $note)
                    ->press('Submit');
        });
        $this->assertDatabaseHas('notes', ['note' => $note]);
        $newNote = \App\Note::where('note', $note)->first();
        $newNote->forceDelete();
    }

    public function test_client_page_updates_syndication()
    {
        $this->browse(function ($browser) {
            $browser->visit(route('micropub-client'))
                    ->assertDontSee('jonnybarnes on Twitter')
                    ->clickLink('Refresh Syndication Targets')
                    ->pause(5000)
                    ->assertSee('jonnybarnes on Twitter');
        });
    }
}

Add test for note creation

Add test for note creation


<?php
# $Id$
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
#

if (! Gmetad($ganglia_ip, $ganglia_port) )
   {
      print "
There was an error collecting ganglia data ".
         "($ganglia_ip:$ganglia_port): $error
\n";
      exit;
   }

# If we have no child data sources, assume something is wrong.
if (!count($grid))
   {
      print "
Ganglia cannot find a data source. Is gmond running?
";
      exit;
   }

# If we only have one cluster source, suppress MetaCluster output.
if (count($grid) == 2 and $context=="meta")
   {
      # Lets look for one cluster (the other is our grid).
      foreach($grid as $source)
         if ($source[CLUSTER])
            {
               $standalone = 1;
               $context = "cluster";
               # Need to refresh data with new context.
               Gmetad($ganglia_ip, $ganglia_port);
               $clustername = $source[NAME];
            }
   }

?>

<?php
# $Id$
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
#

if (! Gmetad($ganglia_ip, $ganglia_port) )
   {
      print "
There was an error collecting ganglia data ".
         "($ganglia_ip:$ganglia_port): $error
\n";
      exit;
   }

# If we have no child data sources, assume something is wrong.
if (!count($grid) and !count($cluster))
   {
      print "
Ganglia cannot find a data source. Is gmond running?
";
      exit;
   }

# If we only have one cluster source, suppress MetaCluster output.
if (count($grid) == 2 and $context=="meta")
   {
      # Lets look for one cluster (the other is our grid).
      foreach($grid as $source)
         if ($source[CLUSTER])
            {
               $standalone = 1;
               $context = "cluster";
               # Need to refresh data with new context.
               Gmetad($ganglia_ip, $ganglia_port);
               $clustername = $source[NAME];
            }
   }

?>

Fix for scalable option bug, pointed out by Jason Smith.

git-svn-id: 27e0aca8c7a52a9ae65dfba2e16879604119af8c@465 93a4e39c-3214-0410-bb16-828d8e3bcd0f


<?
if (!defined("POUET_API")) exit();

$prod = $_GET["id"] ? PouetProd::Spawn((int)$_GET["id"]) : null;
if($prod)
{
  $a = array(&$prod);
  PouetCollectPlatforms( $a );
  PouetCollectAwards( $a );
  unset($prod->views);
}

$result = new stdClass();
if ($prod)
{
  $result->success = true;
  $result->prod = $prod;
}
else
{
  $result->error = true;
}
output($result);
?>

<?
if (!defined("POUET_API")) exit();

$prod = $_GET["id"] ? PouetProd::Spawn((int)$_GET["id"]) : null;
if($prod)
{
  $a = array(&$prod);
  PouetCollectPlatforms( $a );
  PouetCollectAwards( $a );
  unset($prod->views);
  unset($prod->addeduser->lastLogin);
}

$result = new stdClass();
if ($prod)
{
  $result->success = true;
  $result->prod = $prod;
}
else
{
  $result->error = true;
}
output($result);
?>

Hide this for the time being

Hide this for the time being


<?php

namespace PureBilling\Bundle\SDKBundle\Store\V1\Customer;

use Symfony\Component\Validator\Constraints as Assert;
use PureMachine\Bundle\SDKBundle\Store\Annotation as Store;
use PureMachine\Bundle\SDKBundle\Store\Base\BaseStore;

class UpdateCustomer extends BaseStore
{
    /**
     * @Store\Property(description="customer Id. (read only)")
     * @Assert\NotBlank()
     */
    protected $id;

    /**
     * @Store\Property(description="new customer email")
     * @Assert\Type("string")
     * @Assert\Email()
     */
    protected $email;

    /**
     * @Store\Property(description="new metadata to associate")
     * @Assert\Type("array")
     */
    protected $metadata = array();

    public function setMetadata($meta)
    {
        $this->metadata = (array) $meta;
    }

}

<?php

namespace PureBilling\Bundle\SDKBundle\Store\V1\Customer;

use Symfony\Component\Validator\Constraints as Assert;
use PureMachine\Bundle\SDKBundle\Store\Annotation as Store;
use PureMachine\Bundle\SDKBundle\Store\Base\BaseStore;

class UpdateCustomer extends BaseStore
{
    /**
     * @Store\Property(description="customer Id. (read only)")
     * @Assert\NotBlank()
     * @Assert\Type("string")
     */
    protected $id;

    /**
     * @Store\Property(description="new customer email")
     * @Assert\Type("string")
     * @Assert\Email()
     */
    protected $email;

    /**
     * @Store\Property(description="new metadata to associate")
     * @Assert\Type("array")
     */
    protected $metadata = array();

    public function setMetadata($meta)
    {
        $this->metadata = (array) $meta;
    }

}

Fix , added type to id

Fix , added type to id


<?php
/*
QuickResponse Extension for MediaWiki.

@license MIT License
*/

$wgExtensionCredits[ 'other' ][] = array(
    'path' => __FILE__,
    'name' => 'QuickResponse',
    'version' => '0.3.0',
    'url' => '',
    'author' => 'Konarak Ratnakar',
    'descriptionmsg' => 'quickresponse-desc'
);

$wgMessagesDirs['QuickResponse'] = __DIR__ . '/i18n';

$wgResourceModules[ 'QuickResponse' ] = array(
    'scripts' => array('resources/qrcode.js',
                       'resources/jquery.qrcode.js',
                       'resources/quickresponse.js'
                       ),
    'dependencies' =>  'jquery.ui.dialog',
    'messages' => array('quickresponse-desc',
                        'quickresponse-text',
                        'quickresponse-title',
                        'quickresponse-tooltip'
                        ),
    'localBasePath' => __DIR__,
    'remoteExtPath' => 'QuickResponse',
);

$wgHooks[ 'BeforePageDisplay' ][] = function ( $out ) {
    $out->addModules( 'QuickResponse' );
    return true;
};

<?php
/*
QuickResponse Extension for MediaWiki.

@license MIT License
*/

$wgExtensionCredits[ 'other' ][] = array(
    'path' => __FILE__,
    'name' => 'QuickResponse',
    'version' => '0.3.0',
    'url' => '',
    'author' => 'Konarak Ratnakar',
    'descriptionmsg' => 'quickresponse-desc'
);

$wgMessagesDirs['QuickResponse'] = __DIR__ . '/i18n';

$wgResourceModules[ 'QuickResponse' ] = array(
    'scripts' => array('resources/qrcode.js',
                       'resources/jquery.qrcode.js',
                       'resources/quickresponse.js'
                       ),
    'dependencies' =>  'jquery.ui',
    'messages' => array('quickresponse-desc',
                        'quickresponse-text',
                        'quickresponse-title',
                        'quickresponse-tooltip'
                        ),
    'localBasePath' => __DIR__,
    'remoteExtPath' => 'QuickResponse',
);

$wgHooks[ 'BeforePageDisplay' ][] = function ( $out ) {
    $out->addModules( 'QuickResponse' );
    return true;
};

Move dependencies from removed 'jquery.ui.…' modules to 'jquery.ui'

This increases the extension's MediaWiki dependency to version 1.34.

Bug: T219604
Change-Id: Ic0bbb86ec93fff32731d84a7919f4951a9111d5f


<?php

class oxTiramizoo_Events
{
	public static function onActivate()
	{
		try
		{
        	$oTiramizooSetup = oxRegistry::get('oxTiramizoo_Setup');
			$oTiramizooSetup->install();
		} catch (oxException $e) {
			die($e->getMessage());
		}
	}
}

<?php

class oxTiramizoo_Events
{
	public static function onActivate()
	{
		try
		{
        	$oTiramizooSetup = oxRegistry::get('oxTiramizoo_Setup');
			$oTiramizooSetup->install();
		} catch (oxException $e) {
	        // @codeCoverageIgnoreStart
	        if ( !defined( 'OXID_PHP_UNIT' ) ) {
				die($e->getMessage());
	        }
	        // @codeCoverageIgnoreEnd
		}
	}
}

Add code coveerage ignores for setup when is failed


<?php
require_once __DIR__.'/../vendor/autoload.php'; // Auto loads the dependencies, e.g. the whole of silex

// Instantiate the app
$app = new Silex\Application();

// The standard simple hello world example
$app->get('/hello/{name}', function ($name) use ($app) {
  return 'Hello '.$app->escape($name);
});

// An even simpler display of the main page, complete with html in the php, ew!
$app->get('/', function() use ($app){
	return '<body>The main Thinkocracy page!</body>';
});

// Let's get some api call & response working up in here
$app->get('/api/{call}/{data}', function($call, $data) use ($app){
	// We can actually just pass json data encoded for the url to {data} soon.
	$response = 'Call to a api type of '.$call.' with data '.$data;

	return $response; // This will be a json response shortly.
});

// Aw yeah, run dat app
$app->run();

<?php
require_once realpath(__DIR__.'/../').'/vendor/autoload.php'; // Auto loads the dependencies, e.g. the whole of silex

// Instantiate the app
$app = new Silex\Application();

// The standard simple hello world example
$app->get('/hello/{name}', function ($name) use ($app) {
  return 'Hello '.$app->escape($name);
});

// An even simpler display of the main page, complete with html in the php, ew!
$app->get('/', function() use ($app){
	return '<body>The main Thinkocracy page!</body>';
});

// Let's get some api call & response working up in here
$app->get('/api/{call}/{data}', function($call, $data) use ($app){
	// We can actually just pass json data encoded for the url to {data} soon.
	$response = 'Call to a api type of '.$call.' with data '.$data;

	return $response; // This will be a json response shortly.
});

// Aw yeah, run dat app
$app->run();

Index: Fix pathing in the first include of dependencies.


<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
        });
    }

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

<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('facebook_id')->unique();
            $table->string('avatar');
            $table->rememberToken();
            $table->timestamps();
        });
    }

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

Update user migration file with facebook_id column


<?php
require_once 'config.php';
include 'checklogin.php';

include "connect.php";

$mysql_table = MYSQL_TABLE;
$qry="SELECT * FROM `$mysql_table` WHERE `id`>".mysqli_real_escape_string($db, $_GET["lastid"])." ORDER BY `$mysql_table`.`id`";
$result=mysqli_query($db, $qry);
$newlastid=$_GET["lastid"];
$jspo=array();
while ($row = mysqli_fetch_array($result)) {
$newlastid=$newlastid+1;
array_push($jspo, array("txt"=>stripslashes($row["txt"]), "tim"=>$row["tim"], "id"=>$row["id"]));
}
echo json_encode(array("posts"=>$jspo, "lastid"=>$newlastid));

mysqli_close($db);
?>

<?php
require_once 'config.php';
include 'checklogin.php';

include "connect.php";

$mysql_table = MYSQL_TABLE;
$qry="SELECT * FROM `$mysql_table` WHERE `id`>".mysqli_real_escape_string($db, $_GET["lastid"])." ORDER BY `$mysql_table`.`id`";
$result=mysqli_query($db, $qry);
$newlastid=$_GET["lastid"];
$jspo=array();
while ($row = mysqli_fetch_array($result)) {
$newlastid=$row["id"];
array_push($jspo, array("txt"=>stripslashes($row["txt"]), "tim"=>$row["tim"], "id"=>$row["id"]));
}
echo json_encode(array("posts"=>$jspo, "lastid"=>$newlastid));

mysqli_close($db);
?>

Fix multiple appearances when ids are off


<?php

use Symfony\Component\HttpFoundation\Request;

// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

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

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

<?php

use Symfony\Component\HttpFoundation\Request;

// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(0000);

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

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

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Change umask value for dev env

Change umask value for dev env


<?php

namespace Michaeljennings\Feed;

use Illuminate\Support\ServiceProvider;

class FeedServiceProvider extends ServiceProvider
{
    /**
     * @inheritdoc
     */
    public function register()
    {
        $this->app->bind('michaeljennings.feed.repository', 'Michaeljennings\Feed\Notifications\Repository');

        $this->app->bind('michaeljennings.feed', function($app) {
            return new Feed($app['michaeljennings.feed.repository']);
        });

        $this->app->alias('michaeljennings.feed.repository', 'Michaeljennings\Feed\Contracts\Repository');
        $this->app->alias('michaeljennings.feed', 'Michaeljennings\Feed\Contracts\PullFeed');
        $this->app->alias('michaeljennings.feed', 'Michaeljennings\Feed\Contracts\PushFeed');
    }
}

<?php

namespace Michaeljennings\Feed;

use Illuminate\Support\ServiceProvider;

class FeedServiceProvider extends ServiceProvider
{
    /**
     * @inheritdoc
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'/../migrations/' => database_path('migrations')
        ], 'migrations');
    }

    /**
     * @inheritdoc
     */
    public function register()
    {
        $this->app->bind('michaeljennings.feed.repository', 'Michaeljennings\Feed\Notifications\Repository');

        $this->app->bind('michaeljennings.feed', function($app) {
            return new Feed($app['michaeljennings.feed.repository']);
        });

        $this->app->alias('michaeljennings.feed.repository', 'Michaeljennings\Feed\Contracts\Repository');
        $this->app->alias('michaeljennings.feed', 'Michaeljennings\Feed\Contracts\PullFeed');
        $this->app->alias('michaeljennings.feed', 'Michaeljennings\Feed\Contracts\PushFeed');
    }
}

Update the service provider to publish the migrations


<?php

namespace MicroQueue;

class Producer
{
    private $queue = null;

    const ERROR_PRODUCER_QUEUE_IS_FULL = 'Queue reached max number of messages';
    const ERROR_PRODUCER_SEND_UNKNOWN_ERROR = 'Unknown error';
    const PRODUCER_DEFAULT_MESSAGE_TYPE = 1;
    const ERROR_PRODUCER_MESSAGE_BUFFER_OVERFLOW = 'Message size is larger than the allowed value';

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

    public function publish($message)
    {
        if (empty($message)) throw new \RuntimeException('Message cannot be empty');

        $queueResource = $this->queue->getResource();
        $serializeMessage = true;
        $isBlocking = true;
        $errorCode = 0;

        $result = @msg_send(
            $queueResource,
            self::PRODUCER_DEFAULT_MESSAGE_TYPE,
            $message,
            $serializeMessage,
            $isBlocking,
            $errorCode
        );

        if (false === $result) throw new \RuntimeException($this->parseErrorCode($errorCode));

        return true;
    }

    private function parseErrorCode($errorCode)
    {
        if (MSG_EAGAIN == $errorCode) {
            return self::ERROR_PRODUCER_QUEUE_IS_FULL;
        } elseif (PosixErrorCode::EINVAL == $errorCode) {
            return self::ERROR_PRODUCER_MESSAGE_BUFFER_OVERFLOW;
        }
    }
}

<?php

namespace MicroQueue;

class Producer
{
    private $queue = null;

    const ERROR_PRODUCER_QUEUE_IS_FULL = 'Queue reached max number of messages';
    const ERROR_PRODUCER_SEND_UNKNOWN_ERROR = 'Unknown error';
    const PRODUCER_DEFAULT_MESSAGE_TYPE = 1;
    const ERROR_PRODUCER_MESSAGE_BUFFER_OVERFLOW = 'Message size is larger than the allowed value';

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

    public function publish($message)
    {
        if (empty($message)) throw new \RuntimeException('Message cannot be empty');

        $queueResource = $this->queue->getResource();
        $serializeMessage = true;
        $isBlocking = true;
        $errorCode = 0;

        $result = @msg_send(
            $queueResource,
            self::PRODUCER_DEFAULT_MESSAGE_TYPE,
            $message,
            $serializeMessage,
            $isBlocking,
            $errorCode
        );

        if (false === $result) throw new \RuntimeException($this->parseErrorCode($errorCode));

        return true;
    }

    private function parseErrorCode($errorCode)
    {
        if (PosixErrorCode::EINVAL == $errorCode) return self::ERROR_PRODUCER_MESSAGE_BUFFER_OVERFLOW;

        return self::ERROR_PRODUCER_SEND_UNKNOWN_ERROR;
    }
}

Remove unused if statement for error handling

Producer was trying to catch an error that could not been tested so this
line was removed to avoid dead code.


<?php

namespace MssPhp\Schema\Request;

use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlList;

class Room {
    /**
     * @Type("integer")
     */
    public $room_id;

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

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

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

    /**
     * @Type("array<integer>")
     * @XmlList(inline = true, entry="person")
     */
    public $person;
}

<?php

namespace MssPhp\Schema\Request;

use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlList;

class Room {
    /**
     * @Type("integer")
     */
    public $offer_id;

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

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

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

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

    /**
     * @Type("array<integer>")
     * @XmlList(inline = true, entry="person")
     */
    public $person;
}

Add service to room request

Add service to room request


<?php
namespace Sil\SilAuth\saml;

class User
{
    public static function convertToSamlFieldNames(
        string $employeeId,
        string $firstName,
        string $lastName,
        string $username,
        string $email,
        string $uuid,
        string $idpDomainName,
        $passwordExpirationDate,
        array $mfa
    ) {
        return [
            'eduPersonPrincipalName' => [
                $username . '@' . $idpDomainName,
            ],

            /**
             * Misspelled version of eduPersonTargetedID.
             * @deprecated
             */
            'eduPersonTargetID' => (array)$uuid, // Incorrect, deprecated

            /**
             * NOTE: Do NOT include eduPersonTargetedID. If you need it, use the core:TargetedID module, ideally at the
             *       Hub, to generate an eduPersonTargetedID.
             */

            'sn' => (array)$lastName,
            'givenName' => (array)$firstName,
            'mail' => (array)$email,
            'employeeNumber' => (array)$employeeId,
            'cn' => (array)$username,
            'schacExpiryDate' => (array)$passwordExpirationDate,
            'mfa' => $mfa,
        ];
    }
}

<?php
namespace Sil\SilAuth\saml;

class User
{
    public static function convertToSamlFieldNames(
        string $employeeId,
        string $firstName,
        string $lastName,
        string $username,
        string $email,
        string $uuid,
        string $idpDomainName,
        $passwordExpirationDate,
        array $mfa
    ) {
        return [
            'eduPersonPrincipalName' => [
                $username . '@' . $idpDomainName,
            ],

            /**
             * Misspelled version of eduPersonTargetedID.
             * @deprecated
             */
            'eduPersonTargetID' => (array)$uuid, // Incorrect, deprecated

            /**
             * NOTE: Do NOT include eduPersonTargetedID. If you need it, use the core:TargetedID module, ideally at the
             *       Hub, to generate an eduPersonTargetedID.
             */

            'sn' => (array)$lastName,
            'givenName' => (array)$firstName,
            'mail' => (array)$email,
            'employeeNumber' => (array)$employeeId,
            'cn' => (array)$username,
            'schacExpiryDate' => (array)$passwordExpirationDate,
            'mfa' => $mfa,
            'uuid' => (array)$uuid,
        ];
    }
}

Include the uuid with the user attributes


<?php

	echo '

The Book of Shaders by Patricio Gonzalez Vivo

English - 日本語 - 中文版 - 한국어 - Française

	';

?>

<?php

	echo '

The Book of Shaders by Patricio Gonzalez Vivo

English - 日本語 - 中文版 - 한국어 - Français

	';

?>

Fix translation name for french

Fix translation name for french


<?php

	Class DateTimeObj{

		public static function setDefaultTimezone($timezone){
			if(!@date_default_timezone_set($timezone)) trigger_error(E_USER_WARNING, "Invalid timezone '{$timezone}'");
		}

		public static function getGMT($format, $timestamp=NULL){
			return self::get($format, $timestamp, 'GMT');
		}

		public static function getTimeAgo($format){
			return '<abbr class="timeago" title="'.self::get('r').'">'.self::get($format).'</abbr>';
		}

		public static function get($format, $timestamp=NULL, $timezone=NULL){
			if(!$timestamp || $timestamp == 'now') $timestamp = time();
			if(!$timezone) $timezone = date_default_timezone_get();

			$current_timezone = date_default_timezone_get();
			if($current_timezone != $timezone) self::setDefaultTimezone($timezone);

			$ret = date($format, $timestamp);

			if($current_timezone != $timezone) self::setDefaultTimezone($current_timezone);

			return $ret;

		}

	}

<?php

	Class DateTimeObj{

		public static function setDefaultTimezone($timezone){
			if(!@date_default_timezone_set($timezone)) trigger_error("Invalid timezone '{$timezone}'", E_USER_WARNING);
		}

		public static function getGMT($format, $timestamp=NULL){
			return self::get($format, $timestamp, 'GMT');
		}

		public static function getTimeAgo($format){
			return '<abbr class="timeago" title="'.self::get('r').'">'.self::get($format).'</abbr>';
		}

		public static function get($format, $timestamp=NULL, $timezone=NULL){
			if(!$timestamp || $timestamp == 'now') $timestamp = time();
			if(!$timezone) $timezone = date_default_timezone_get();

			$current_timezone = date_default_timezone_get();
			if($current_timezone != $timezone) self::setDefaultTimezone($timezone);

			$ret = date($format, $timestamp);

			if($current_timezone != $timezone) self::setDefaultTimezone($current_timezone);

			return $ret;

		}

	}

Swap the arguments being passed to trigger_error().

Fixes issue #247
http://symphony-cms.com/discuss/issues/view/247/


<?php

namespace common\models\search;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Remark;
use common\commands\CompanyAccess;

/**
 * RemarkSearch represents the model behind the search form about `common\models\Remark`.
 */
class RemarkSearch extends Remark
{
    public function rules()
    {
        return [
            [['id', 'significance', 'company_id'], 'integer'],
            [['description', 'event_date', 'create_date'], 'safe'],
        ];
    }

    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    public function search($params)
    {
        $query = Remark::find()->joinWith('company');
        $CompanyAccess = new CompanyAccess();
        $query->andWhere( $CompanyAccess->getQueryConditions() );

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'event_date' => $this->event_date,
            'create_date' => $this->create_date,
            'significance' => $this->significance,
            'company_id' => $this->company_id,
        ]);

        $query->andFilterWhere(['like', 'description', $this->description]);

        return $dataProvider;
    }
}

<?php

namespace common\models\search;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Remark;
use common\commands\CompanyAccess;

/**
 * RemarkSearch represents the model behind the search form about `common\models\Remark`.
 */
class RemarkSearch extends Remark
{
    public function rules()
    {
        return [
            [['id', 'significance', 'company_id'], 'integer'],
            [['description', 'event_date', 'create_date'], 'safe'],
        ];
    }

    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    public function search($params)
    {
        $company_id = \Yii::$app->session['selected_company_id'];
        $query = Remark::find()->joinWith('company');
        $CompanyAccess = new CompanyAccess();
        $query->andWhere( $CompanyAccess->getQueryConditions() );
        $query->andWhere(['company_id' => $company_id]);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'event_date' => $this->event_date,
            'create_date' => $this->create_date,
            'significance' => $this->significance,
            'company_id' => $this->company_id,
        ]);

        $query->andFilterWhere(['like', 'description', $this->description]);

        return $dataProvider;
    }
}

Modify the search to only fetch the selected company


<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        Commands\DeleteExpiredActivations::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     *
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();

        $schedule->command('activations:clean')->daily();
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        Commands\DeleteExpiredActivations::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     *
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();

        $schedule->command('activations:clean')->daily();
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}

Add 'Commands' directory scan for artisan commands


<?php
namespace tests;

use PHPUnit\Framework\TestCase;
use SD\Currency\Repository;
use SD\Currency\Store\FileStore;

class RepositoryTest extends TestCase {
    public function testGetOptions() {
        $repository = new Repository();
        $repository->setStore(new FileStore(__DIR__));
        $options = $repository->getOptions();
        $this->assertInternalType('array', $options, 'Options must be an array');
        $this->assertGreaterThanOrEqual(3, count($options), 'Must return at least 3 options');
        foreach ($options as $option) {
            foreach ([
                'code' => 'string',
                'symbol' => 'string',
                'rate' => 'float',
            ] as $field => $type) {
                $this->assertInternalType('object', $option, "Option must be an object");
                $this->assertObjectHasAttribute($field, $option, "Option must contain $field field");
                $this->assertInternalType($type, $option->$field, "Field $field must have type $type");
            }
        }
    }
}

<?php
namespace tests;

use PHPUnit\Framework\TestCase;
use SD\Currency\Model\Registry;
use SD\Currency\Repository;
use SD\Currency\Store\FileStore;

class RepositoryTest extends TestCase {
    /**
     * @dataProvider createMoneyDataProvider
    **/
    public function testCreateMoney($amount, $currency, $expectedCurrency) {
        $repository = new Repository();
        $money = $repository->createMoney($amount, $currency);
        $this->assertInstanceOf(Money::class, $money, 'Created money must be of money class');
        $this->assertEquals($amount, $money->getAmount(), 'Created amount must match');
        $this->assertEquals($expectedCurrency, $money->getCurrency(), 'Created currency must match');
    }

    public function createMoneyDataProvider() {
        $registry = new Registry();
        return [
            [
                'amount' => 450,
                'currency' => $registry->getByCode('RUB'),
                'expectedCurrency' => $registry->getByCode('RUB'),
                'description' => 'Currency as object',
            ],
            [
                'amount' => 550,
                'currency' => 'USD',
                'expectedCurrency' => $registry->getByCode('USD'),
                'description' => 'Currency as string',
            ],
        ];
    }

    public function testGetOptions() {
        $repository = new Repository();
        $repository->setStore(new FileStore(__DIR__));
        $options = $repository->getOptions();
        $this->assertInternalType('array', $options, 'Options must be an array');
        $this->assertGreaterThanOrEqual(3, count($options), 'Must return at least 3 options');
        foreach ($options as $option) {
            foreach ([
                'code' => 'string',
                'symbol' => 'string',
                'rate' => 'float',
            ] as $field => $type) {
                $this->assertInternalType('object', $option, "Option must be an object");
                $this->assertObjectHasAttribute($field, $option, "Option must contain $field field");
                $this->assertInternalType($type, $option->$field, "Field $field must have type $type");
            }
        }
    }
}

Add test for create money

Add test for create money


<?php
namespace Light\ObjectService\Formats\Json\Serializers;

use Light\ObjectService\Service\Protocol\ExceptionSerializer;

class DefaultExceptionSerializer extends BaseSerializer implements ExceptionSerializer
{
	/** @var bool */
	protected $detailed;

	public function __construct($detailed = false, $contentType = "application/json")
	{
		parent::__construct($contentType);
		$this->detailed = $detailed;
	}

	/**
	 * Serializes an exception.
	 * @param \Exception $e
	 * @return string
	 */
	public function serialize(\Exception $e)
	{
		return json_encode($this->serializeToObject($e));
	}

	public function serializeToObject(\Exception $e)
	{
		$json = new \stdClass();
		$json->exceptionClass = get_class($e);
		$json->message = $e->getMessage();
		if ($previous = $e->getPrevious())
		{
			$json->previous = $this->serializeToObject($previous);
		}
		return $json;
	}
}

<?php
namespace Light\ObjectService\Formats\Json\Serializers;

use Light\ObjectService\Service\Protocol\ExceptionSerializer;

class DefaultExceptionSerializer extends BaseSerializer implements ExceptionSerializer
{
	/** @var bool */
	protected $detailed;

	public function __construct($detailed = false, $contentType = "application/json")
	{
		parent::__construct($contentType);
		$this->detailed = $detailed;
	}

	/**
	 * Serializes an exception.
	 * @param \Exception $e
	 * @return string
	 */
	public function serialize(\Exception $e)
	{
		return json_encode($this->serializeToObject($e));
	}

	public function serializeToObject(\Exception $e)
	{
		$json = new \stdClass();
		$json->exceptionClass = get_class($e);
		$json->message = $e->getMessage();
		if ($previous = $e->getPrevious())
		{
			$json->previous = $this->serializeToObject($previous);
		}
		if ($this->detailed)
		{
			$json->trace = $e->getTrace();
		}
		return $json;
	}
}

Add stack trace to exceptions in detailed mode


<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
	"type" => 'MySQLDatabase',
	"server" => 'localhost',
	"username" => 'root',
	"password" => 'root',
	"database" => 'sitesprocket24',
	"path" => '',
);

MySQLDatabase::set_connection_charset('utf8');

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('sitesprocket');

// Set the site locale
i18n::set_locale('en_US');

// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();

// Force WWW
//Director::forceWWW();

// Force environment to Dev
Director::set_environment_type('dev');

// Temporary fix for Cookie Issue
Cookie::set_report_errors(false);

// Set default Login
Security::setDefaultAdmin('admin','pass');

<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
	"type" => 'MySQLDatabase',
	"server" => 'localhost',
	"username" => 'root',
	"password" => 'Redrooster8',
	"database" => 'sitesprocket24',
	"path" => '',
);

MySQLDatabase::set_connection_charset('utf8');

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('sitesprocket');

// Set the site locale
i18n::set_locale('en_US');

// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();

// Force WWW
//Director::forceWWW();

// Force environment to Dev
Director::set_environment_type('dev');

// Temporary fix for Cookie Issue
Cookie::set_report_errors(false);

// Set default Login
Security::setDefaultAdmin('admin','pass');

UPDATE - Forgot password . . . again

UPDATE - Forgot password . . . again