<?php

/*
 * This file is part of the Active Collab Payments project.
 *
 * (c) A51 doo <info@activecollab.com>. All rights reserved.
 */

declare(strict_types=1);

namespace ActiveCollab\Payments\Merchant;

use ActiveCollab\Payments\Gateway\GatewayInterface;

interface MerchantInterface
{
    public function getReference(GatewayInterface $gateway);

    public function getOurReference();
}

<?php

/*
 * This file is part of the Active Collab Payments project.
 *
 * (c) A51 doo <info@activecollab.com>. All rights reserved.
 */

declare(strict_types=1);

namespace ActiveCollab\Payments\Merchant;

use ActiveCollab\Payments\Gateway\GatewayInterface;

interface MerchantInterface
{
    public function getReference(GatewayInterface $gateway): string;

    public function getOurReference(): string;
}

Set return types for reference methods in Merchant interface


<?php
use Galahad\LaravelAddressing\Country;
use Galahad\LaravelAddressing\CountryCollection;

/**
 * Class CountryCollectionTest
 *
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class CountryCollectionTest extends PHPUnit_Framework_TestCase
{
    public function testCountryCollectionClass()
    {
        $collection = new CountryCollection();
        $country = new Country;
        $countries = ['Brazil', 'United States', 'Argentina', 'Canada', 'Chile'];
        foreach ($countries as $countryName) {
            $collection->insert($country->findByName($countryName));
        }
        /** @var Country $country */
        foreach ($collection as $key => $country) {
            $this->assertEquals($country->getName(), $countries[$key]);
        }
    }
}

<?php
use Galahad\LaravelAddressing\Country;
use Galahad\LaravelAddressing\CountryCollection;

/**
 * Class CountryCollectionTest
 *
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class CountryCollectionTest extends PHPUnit_Framework_TestCase
{
    public function testCountryCollectionClass()
    {
        $collection = new CountryCollection();
        $country = new Country;
        $countries = ['Brazil', 'United States', 'Argentina', 'Canada', 'Chile'];
        foreach ($countries as $countryName) {
            $collection->insert($country->findByName($countryName));
        }
        /** @var Country $country */
        foreach ($collection as $key => $country) {
            $this->assertEquals($country->getName(), $countries[$key]);
        }
    }

    public function testToListFeature()
    {
        $factory = new Country;
        $expected = ['BR' => 'Brazil', 'US' => 'United States'];
        $collection = new CountryCollection();
        $collection->insert([
            $factory->findByCode('BR'),
            $factory->findByCode('US'),
        ]);
        $this->assertEquals($collection->toList(), $expected);
    }
}

Test if the toList() method is returning the correct array values


<?php
/**
 * Plugin Name: Culture Object
 * Plugin URI: http://cultureobject.co.uk
 * Description: A framework as a plugin to enable sync of culture objects into WordPress.
 * Version: 2.0.0
 * Author: Liam Gladdy / Thirty8 Digital
 * Author URI: https://www.gladdy.uk / http://www.thirty8digital.co.uk
 * GitHub Plugin URI: Thirty8Digital/CultureObject
 * License: Apache 2 License
 */

if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
	require('culture-object-init.php');
} else {
	$ver = phpversion();
	trigger_error("Culture Object requires at least PHP 5.3. You're on an unsupported and unmaintained version of PHP (".$ver.") which could contain major security holes and should upgrade immediately. Please contact your webhost for further assistance in this.", E_USER_ERROR);
	exit();
}

<?php
/**
 * Plugin Name: Culture Object
 * Plugin URI: http://cultureobject.co.uk
 * Description: A framework as a plugin to enable sync of culture objects into WordPress.
 * Version: 2.0.0
 * Author: Liam Gladdy / Thirty8 Digital
 * Author URI: https://www.gladdy.uk / http://www.thirty8digital.co.uk
 * GitHub Plugin URI: Thirty8Digital/CultureObject
 * GitHub Branch: master
 * License: Apache 2 License
 */

if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
	require('culture-object-init.php');
} else {
	$ver = phpversion();
	trigger_error("Culture Object requires at least PHP 5.3. You're on an unsupported and unmaintained version of PHP (".$ver.") which could contain major security holes and should upgrade immediately. Please contact your webhost for further assistance in this.", E_USER_ERROR);
	exit();
}

Add branch to github-updater configuration

We'll probably need to create a branch call releases and tag off that for all future releases to avoid github updater taking them to master.


<?php

namespace Oro\Bundle\ReportBundle\Migrations\Schema\v1_1;

use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
use Oro\Bundle\ReportBundle\Migrations\Schema\v1_0\OroReportBundle as OroReportSchemaMigration1_0;

class OroReportBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        $table = $schema->getTable(OroReportSchemaMigration1_0::TABLE_NAME);
        $table->addColumn('chart_options', 'array');
    }
}

<?php

namespace Oro\Bundle\ReportBundle\Migrations\Schema\v1_1;

use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
use Oro\Bundle\ReportBundle\Migrations\Schema\v1_0\OroReportBundle as OroReportSchemaMigration1_0;

class OroReportBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        $table = $schema->getTable(OroReportSchemaMigration1_0::TABLE_NAME);
        $table->addColumn('chart_options', 'array', ['notnull' => false]);
    }
}

BAP-3246: Store chart options in report entity
-add field and migration


<?php
/**
 * This file is part of the BootstrapBundle project.
 *
 * (c) 2013 Philipp Boes <mostgreedy@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace P2\Bundle\BootstrapBundle\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
 * Class BaseTypeExtension
 * @package P2\Bundle\BootstrapBundle\Form\Extension
 */
abstract class BaseTypeExtension extends AbstractTypeExtension
{
    /**
     * {@inheritDoc}
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $view->vars['horizontal'] = $options['horizontal'];
        $view->vars['inline'] = $options['inline'];
        $view->vars['grid'] = $options['grid'];
    }

    /**
     * {@inheritDoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(
            array(
                'horizontal' => true,
                'inline' => false,
                'grid' => array('sm' => array(4,8)),
            )
        );

        $resolver->setAllowedValues(
            array(
                'horizontal' => array(true, false),
                'inline' => array(true, false)
            )
        );
    }
}

<?php
/**
 * This file is part of the BootstrapBundle project.
 *
 * (c) 2013 Philipp Boes <mostgreedy@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace P2\Bundle\BootstrapBundle\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
 * Class BaseTypeExtension
 * @package P2\Bundle\BootstrapBundle\Form\Extension
 */
abstract class BaseTypeExtension extends AbstractTypeExtension
{
    /**
     * {@inheritDoc}
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $view->vars['horizontal'] = $options['horizontal'];
        $view->vars['inline'] = $options['inline'];
        $view->vars['grid'] = $options['grid'];
    }

    /**
     * {@inheritDoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(
            array(
                'horizontal' => true,
                'inline' => false,
                'grid' => array('sm' => array(4,8)),
            )
        );

        $resolver->setAllowedTypes(array('horizontal' => 'bool', 'inline' => 'bool', 'grid' => 'array'));
    }
}

Add restriction to allowed types in base type extension


<?php
	//used to control access to item stored in the session
	//used when trying to save and item with errors and need to preload form
	//or when saving and adding another

/**
*
*/
class SessionItemController{
	const SESSION_ITEM_KEY = 'item';

	//stores given item in session
	static function setItem(array $item){
		$_SESSION[self::SESSION_ITEM_KEY] = $item;
	}

	//returns item and deletes from session
	//so it does not persist between pages
	static function getItem(): array{
		if(self::isItemStored()){
			$item = $_SESSION[self::SESSION_ITEM_KEY];
			self::deleteItem();
			return $item;
		}
		return [];
	}

	//used to check if item is saved in session
	static function isItemStored(): bool{
		return isset($_SESSION[self::SESSION_ITEM_KEY] && !empty($_SESSION[self::SESSION_ITEM_KEY]));
	}
	//deletes item from session
	static function deleteItem(){
		unset($_SESSION[self::SESSION_ITEM_KEY]);
	}

}

<?php
	//used to control access to item stored in the session
	//used when trying to save and item with errors and need to preload form
	//or when saving and adding another

/**
*
*/
class SessionItemController{
	const SESSION_ITEM_KEY = 'item';

	//stores given item in session
	static function setItem(array $item){
		$_SESSION[self::SESSION_ITEM_KEY] = $item;
	}

	//returns item and deletes from session
	//so it does not persist between pages
	static function getItem(): array{
		if(self::isItemStored()){
			$item = $_SESSION[self::SESSION_ITEM_KEY];
			self::deleteItem();
			return $item;
		}
		return [];
	}

	//used to check if item is saved in session
	static function isItemStored(): bool{
		return isset($_SESSION[self::SESSION_ITEM_KEY]) && !empty($_SESSION[self::SESSION_ITEM_KEY]);
	}
	//deletes item from session
	static function deleteItem(){
		unset($_SESSION[self::SESSION_ITEM_KEY]);
	}

}

Fix typo in session item controller

Fix typo in session item controller


<?php

namespace SilverStripe\Forms\Tests;

class SegmentFieldTestModifier extends AbstractSegmentFieldModifier
{
    /**
     * @inheritdoc
     *
     * @param string $value
     *
     * @return string
     */
    public function getSuggestion($value) {
        return strtoupper($value);
    }

    /**
     * @inheritdoc
     *
     * @param string $value
     *
     * @return string
     */
    public function getPreview($value) {
        return strtolower($value);
    }
}

<?php

namespace SilverStripe\Forms\Tests;

use SilverStripe\Forms\SegmentFieldModifier\AbstractSegmentFieldModifier;

class SegmentFieldTestModifier extends AbstractSegmentFieldModifier
{
    /**
     * @inheritdoc
     *
     * @param string $value
     *
     * @return string
     */
    public function getSuggestion($value) {
        return strtoupper($value);
    }

    /**
     * @inheritdoc
     *
     * @param string $value
     *
     * @return string
     */
    public function getPreview($value) {
        return strtolower($value);
    }
}

FIX Add namespace import for stub modifier


<?php

/**
 * Renders a tag cloud, with more frequently used tags appearing larger.
 */

if (! $this->internal) {
	$page->layout = $appconf['Blog']['layout'];
	$page->title = i18n_get ('Tags');
}

$pg->limit = 10;
$pg->tags = blog\Post::tags ();
foreach ($pg->tags as $k => $v) {
	$pg->tags[$k] = ($v / 10 < 2) ? $v / 10 + .9 : (($v / 10 >= 2) ? 3 : $v / 10);
}

echo $tpl->render ('blog/tags', $pg);

$page->add_script (sprintf (
	'<link rel="alternate" type="application/rss+xml" href="http://%s/blog/rss" />',
	$_SERVER['HTTP_HOST']
));

?>

<?php

/**
 * Renders a tag cloud, with more frequently used tags appearing larger.
 */

if (! $this->internal) {
	$page->layout = $appconf['Blog']['layout'];
	$page->title = i18n_get ('Tags');
}

$pg = new stdClass;
$pg->tags = blog\Post::tags ();
foreach ($pg->tags as $k => $v) {
	$pg->tags[$k] = ($v / 10 < 2) ? $v / 10 + .9 : (($v / 10 >= 2) ? 3 : $v / 10);
}

echo $tpl->render ('blog/tags', $pg);

$page->add_script (sprintf (
	'<link rel="alternate" type="application/rss+xml" href="http://%s/blog/rss" />',
	$_SERVER['HTTP_HOST']
));

?>

Fix the warning for strict mode (PHP 5.4)


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Experience extends Model
{
    //

  public $table ='experiences';
  protected $fillable = ['id','user_id','experience_type','company_name',
  'internship_field_id','work_type','work_from','work_to','stipend',
  'salary','job_description','location','organization','link','certificate','mark'];

  public function user(){
    return $this->belongsTo('App\User');
  }

  public function setWorkFromAttribute($value){
    $this->attributes['work_from'] = $this->validateDateString($value);
  }
  public function setWorkToAttribute($value){
    $this->attributes['work_to'] = $this->validateDateString($value);
  }

  // Private

  private function validateDateString($value){
    $checkDate = \DateTime::createFromFormat('Y-m-d',$value);
    return $checkDate == $value?$value:null;
  }
}

<?php

namespace App;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Experience extends Model
{
    //

  public $table ='experiences';
  protected $fillable = ['id','user_id','experience_type','company_name',
  'internship_field_id','work_type','work_from','work_to','stipend',
  'salary','job_description','location','organization','link','certificate','mark'];

  public function user(){
    return $this->belongsTo('App\User');
  }

  public function setWorkFromAttribute($value){
    $this->attributes['work_from'] = $this->validateDateString($value);
  }
  public function setWorkToAttribute($value){
    $this->attributes['work_to'] = $this->validateDateString($value);
  }

  // Private

  private function validateDateString($value){
    $checkDate = Carbon::createFromFormat('Y-m-d',$value);
    $checkDate = $checkDate->format('Y-m-d');
    return $checkDate == $value?$value:null;
  }
}

Use Carbon instead of default PHP Date

Use Carbon instead of default PHP Date


<?php

namespace Recurrence\tests\units\RruleTransformer;

require_once __DIR__.'/../../../../src/Recurrence/RruleTransformer/FreqTransformer.php';

use atoum;

/**
 * Class FreqTransformer
 * @package Recurrence\tests\units\RruleTransformer
 */
class FreqTransformer extends atoum
{
    /**
     * Failed : Missing frequency value
     */
    public function testMissingValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Failed : Use an invalid frequency value
     */
    public function testInvalidValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=INVALID;DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Success : Use an valid frequency value
     */
    public function testValidValue()
    {
        $frequency = (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=MONTHLY;DTSTART=20170520;INTERVAL=1');

        $this->assert
            ->string((string) $frequency)
            ->isEqualTo('MONTHLY')
        ;
    }
}

<?php

namespace Recurrence\tests\units\RruleTransformer;

require_once __DIR__.'/../../../../src/Recurrence/RruleTransformer/FreqTransformer.php';

use atoum;

/**
 * Class FreqTransformer
 * @package Recurrence\tests\units\RruleTransformer
 */
class FreqTransformer extends atoum
{
    /**
     * Failed : Missing frequency value
     */
    public function testMissingValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Failed : Use an invalid frequency value, but pattern match on first check
     */
    public function testInvalidValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=INVALID;DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Failed : Use an invalid frequency value, but patter do not match at all
     */
    public function testReallyInvalidValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=666;DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Success : Use an valid frequency value
     */
    public function testValidValue()
    {
        $frequency = (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=MONTHLY;DTSTART=20170520;INTERVAL=1');

        $this->assert
            ->string((string) $frequency)
            ->isEqualTo('MONTHLY')
        ;
    }
}

Increase code coverage on FrequencyTransformer


<?php

/**
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 * @license: MIT
 */

namespace IDCI\Bundle\StepBundle\Step\Type\Form;

use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class HtmlStepFormType extends AbstractStepFormType
{
    /**
     * {@inheritdoc}
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        parent::buildView($view, $form, $options);

        $content = $options['content'];
        if (null !== $form->getData('content')) {
            $content = $form->getData('content');
        }

        $view->vars = array_merge($view->vars, array(
            'content' => $content,
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        parent::setDefaultOptions($resolver);

        $resolver
            ->setDefaults(array(
                'content' => null,
                'attr'    => array('class' => 'html_text'),
            ))
            ->setAllowedTypes(array('content' => array('null', 'string')))
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'idci_step_step_form_html';
    }
}

<?php

/**
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 * @license: MIT
 */

namespace IDCI\Bundle\StepBundle\Step\Type\Form;

use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\Options;

class HtmlStepFormType extends AbstractStepFormType
{
    /**
     * {@inheritdoc}
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        parent::buildView($view, $form, $options);

        $content = $options['content'];
        if (null !== $form->getData('content')) {
            $content = $form->getData('content');
        }

        $view->vars = array_merge($view->vars, array(
            'content' => $content,
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        parent::setDefaultOptions($resolver);

        $resolver
            ->setDefaults(array(
                'content' => null,
            ))
            ->setAllowedTypes(array('content' => array('null', 'string')))
            ->setNormalizers(array(
                'attr' => function (Options $options, $value) {
                    if (!isset($value['class'])) {
                        $value['class'] = 'html_text';
                    }

                    return $value;
                }
            ))
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'idci_step_step_form_html';
    }
}

Use normalizer to override unset 'class' attr on html step type


		<link href='http://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>

Be right back.

		<link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>

Be right back.

Use relative href on 503 font path

Use relative href on 503 font path


<?php

namespace FluxBB\Server\Exception;

use Illuminate\Support\MessageBag;

class ValidationFailed extends \Exception
{
    protected $errors;

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

    /**
     * Get all validation errors.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getErrors()
    {
        return new $this->errors;
    }
}

<?php

namespace FluxBB\Server\Exception;

use Illuminate\Support\MessageBag;

class ValidationFailed extends \Exception
{
    protected $errors;

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

    /**
     * Get all validation errors.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getErrors()
    {
        return $this->errors;
    }
}

Fix validation errors not being passed on correctly.


<?php namespace Zeropingheroes\Lanager\Seeds;

use	Zeropingheroes\Lanager\Events\Types\Type;
use Illuminate\Database\Seeder,
	Illuminate\Support\Facades\DB;

class EventTypesTableSeeder extends Seeder {

	public function run()
	{
		if( DB::table('event_types')->count()) return; // don't seed if table is not empty

		$eventTypes = array(
			array(
				'name'	=> 'Ceremony',
				'colour'=>	'',
			),
			array(
				'name'	=> 'Big Game',
				'colour'=>	'#19A601', // light green
			),
			array(
				'name'	=> 'Tournament',
				'colour'=>	'#19A601', // light green
			),
			array(
				'name'	=> 'Food',
				'colour'=>	'',
			),

		);

		foreach($eventTypes as $eventType)
		{
			Type::create($eventType);
		}
	}
}

<?php namespace Zeropingheroes\Lanager\Seeds;

use	Zeropingheroes\Lanager\EventTypes\EventType;
use Illuminate\Database\Seeder,
	Illuminate\Support\Facades\DB;

class EventTypesTableSeeder extends Seeder {

	public function run()
	{
		if( DB::table('event_types')->count()) return; // don't seed if table is not empty

		$eventTypes = array(
			array(
				'name'	=> 'Ceremony',
				'colour'=>	'',
			),
			array(
				'name'	=> 'Big Game',
				'colour'=>	'#19A601', // light green
			),
			array(
				'name'	=> 'Tournament',
				'colour'=>	'#19A601', // light green
			),
			array(
				'name'	=> 'Food',
				'colour'=>	'',
			),

		);

		foreach($eventTypes as $eventType)
		{
			EventType::create($eventType);
		}
	}
}

Update reference to resource renamed in 04ae000d7


@extends('components.content-area')

@section('content')
    @include('components.page-title', ['title' => $page['title']])

        {!! $page['content']['main'] !!}

                    First Name
                    Last Name
                    Email

                @for ($i = 0; $i < 10; $i++)

                        {{ $faker->firstName }}
                        {{ $faker->lastName }}
                        {{ $faker->email }}

                @endfor

        See Table Code

        {!! htmlspecialchars('

        ') !!}

@endsection

Convert from jquery to vanilla JS

Convert from jquery to vanilla JS


{{ Form::label('name', 'Candidate Name') }}
{{ Form::text('name') }}
{{ $errors->first('name', ':message') }}

{{ Form::label('category_id', 'Category') }}
{{ Form::select('category_id', Category::lists('name', 'id'), ( isset($candidate) ? $candidate->category : null )); }}
{{ $errors->first('category_id', ':message') }}

{{ Form::label('description', 'Photo (optional)') }}
{{ Form::file('photo') }}
{{ $errors->first('photo', ':message') }}

{{ Form::label('description', 'Description (optional)') }}
{{ Form::textarea('description') }}
{{ $errors->first('description', ':message') }}

{{ Form::label('name', 'Candidate Name') }}
{{ Form::text('name') }}
{{ $errors->first('name', ':message') }}

{{ Form::label('category_id', 'Category') }}
{{ Form::select('category_id', Category::lists('name', 'id'), ( isset($candidate->category) ? $candidate->category : null )); }}
{{ $errors->first('category_id', ':message') }}

{{ Form::label('description', 'Photo (optional)') }}
{{ Form::file('photo') }}
{{ $errors->first('photo', ':message') }}

{{ Form::label('description', 'Description (optional)') }}
{{ Form::textarea('description') }}
{{ $errors->first('description', ':message') }}

Fix category dropdown not showing correct state.


<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\Test;

use PHPUnit\Framework\TestCase;
use Composer\Factory;

class FactoryTest extends TestCase
{
    /**
     * @group TLS
     */
    public function testDefaultValuesAreAsExpected()
    {
        $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();

        $ioMock->expects($this->once())
            ->method("writeError");

        $config = $this
            ->getMockBuilder('Composer\Config')
            ->getMock();

        $config->method('get')
            ->with($this->equalTo('disable-tls'))
            ->will($this->returnValue(true));

        Factory::createRemoteFilesystem($ioMock, $config);
    }
}

<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\Test;

use PHPUnit\Framework\TestCase;
use Composer\Factory;

class FactoryTest extends TestCase
{
    /**
     * @group TLS
     */
    public function testDefaultValuesAreAsExpected()
    {
        $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();

        $ioMock->expects($this->once())
            ->method("writeError")
            ->with($this->equalTo('<warning>You are running Composer with SSL/TLS protection disabled.</warning>'));

        $config = $this
            ->getMockBuilder('Composer\Config')
            ->getMock();

        $config->method('get')
            ->with($this->equalTo('disable-tls'))
            ->will($this->returnValue(true));

        Factory::createRemoteFilesystem($ioMock, $config);
    }
}

Check for the actual warning description


<?php

namespace SebastiaanLuca\Router\Routers;

use Illuminate\Contracts\Routing\Registrar as RegistrarContract;

/**
 * Class BaseRouter
 *
 * The base class every router should extend.
 *
 * @package SebastiaanLuca\Router\Routers
 */
abstract class BaseRouter implements RouterInterface
{

    /**
     * The routing instance.
     *
     * @var \SebastiaanLuca\Router\ExtendedRouter|\Illuminate\Routing\Router
     */
    protected $router;

    /**
     * The default controller namespace.
     *
     * @var string
     */
    protected $namespace = '';

    /**
     * BaseRouter constructor.
     *
     * @param \Illuminate\Contracts\Routing\Registrar $router
     */
    public function __construct(RegistrarContract $router)
    {
        $this->router = $router;

        $this->map();
    }

    /**
     * Get the default namespace with the suffix attached.
     *
     * @param string|null $suffix
     *
     * @return string
     */
    public function getNamespace($suffix = null)
    {
        if (! $suffix) {
            return $this->namespace;
        }

        return $this->namespace . '\\' . $suffix;
    }

    /**
     * Map the routes.
     */
    public abstract function map();

}

<?php

namespace SebastiaanLuca\Router\Routers;

use Illuminate\Contracts\Routing\Registrar as RegistrarContract;

/**
 * Class BaseRouter
 *
 * The base class every router should extend.
 *
 * @package SebastiaanLuca\Router\Routers
 */
abstract class BaseRouter implements RouterInterface
{

    /**
     * The routing instance.
     *
     * @var \SebastiaanLuca\Router\ExtendedRouter|\Illuminate\Routing\Router
     */
    protected $router;

    /**
     * The Dingo API router.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $api;

    /**
     * The default controller namespace.
     *
     * @var string
     */
    protected $namespace = '';

    /**
     * BaseRouter constructor.
     *
     * @param \Illuminate\Contracts\Routing\Registrar $router
     */
    public function __construct(RegistrarContract $router)
    {
        $this->router = $router;

        $this->setUpApiRouter();

        $this->map();
    }

    /**
     * Assign the API router if the Dingo API package is installed.
     */
    protected function setUpApiRouter()
    {
        if (class_exists('\Dingo\Api\Routing\Router')) {
            $this->api = app('\Dingo\Api\Routing\Router');
        }
    }

    /**
     * Get the default namespace with the suffix attached.
     *
     * @param string|null $suffix
     *
     * @return string
     */
    public function getNamespace($suffix = null)
    {
        if (! $suffix) {
            return $this->namespace;
        }

        return $this->namespace . '\\' . $suffix;
    }

    /**
     * Map the routes.
     */
    public abstract function map();

}

Add a feature to detected use of the Dingo API package and assign its router for ease-of-use


<?php

namespace AbleCore;

class HTML {

	public static function image($source, $alt = '', $title = '', array $attributes = array(), array $options = array())
	{
		$default_options = array(
			'type' => 'theme',
		);
		$options = array_replace_recursive($default_options, $options);

		$variables = array();
		switch($options['type']) {
			case 'theme':
				$variables['path'] = path_to_theme() . '/' . $source;
				break;
			default:
				$variables['path'] = $source;
		}
		if ($alt) {
			$variables['alt'] = $alt;
		}
		if ($title) {
			$variables['title'] = $title;
		}
		if (count($attributes) > 0) {
			if (array_key_exists('width', $attributes)) {
				$variables['width'] = $attributes['width'];
				unset($attributes['width']);
			}
			if (array_key_exists('height', $attributes)) {
				$variables['height'] = $attributes['height'];
				unset($attributes['height']);
			}
			$variables['attributes'] = $attributes;
		}

		return theme('image', $variables);
	}

}

<?php

namespace AbleCore;

class HTML {

	public static function image($source, $alt = '', $title = '', array $attributes = array(), array $options = array())
	{
		$default_options = array(
			'type' => 'theme',
		);
		$options = array_replace_recursive($default_options, $options);

		$variables = array();
		switch($options['type']) {
			case 'theme':
				global $theme;
				$variables['path'] = drupal_get_path('theme', $theme) . '/' . $source;
				break;
			default:
				$variables['path'] = $source;
		}
		if ($alt) {
			$variables['alt'] = $alt;
		}
		if ($title) {
			$variables['title'] = $title;
		}
		if (count($attributes) > 0) {
			if (array_key_exists('width', $attributes)) {
				$variables['width'] = $attributes['width'];
				unset($attributes['width']);
			}
			if (array_key_exists('height', $attributes)) {
				$variables['height'] = $attributes['height'];
				unset($attributes['height']);
			}
			$variables['attributes'] = $attributes;
		}

		return theme('image', $variables);
	}

}

Update the image helper to use drupal_get_path instead of path_to_theme().


<?php
namespace DBAL;

interface DBInterface{
    public function query($sql);
    public function select($table);
    public function selectAll($table);
    public function insert($table, $records);
    public function update($table, $records);
    public function delete($table, $where);
    public function count($table);
    public function truncate($table);

    public function numRows();
    public function rowCount();
    public function lastInsertId();
}

<?php
namespace DBAL;

interface DBInterface{
    public function query($sql);
    public function select($table);
    public function selectAll($table);
    public function fetchColumn($table);
    public function insert($table, $records);
    public function update($table, $records);
    public function delete($table, $where);
    public function count($table);
    public function truncate($table);

    public function numRows();
    public function rowCount();
    public function lastInsertId();
}

Update interface to include fetchColumn

Update interface to include fetchColumn


  @if( !empty($entry->{$column['src']}) )
    {$column['src']} }}"
      target="_blank"
    >
      {$column['src']} }}"
        style="
          height: {{ isset($column['height']) ? $column['height'] : "25px" }};
          width: {{ isset($column['width']) ? $column['width'] : "auto" }};
          border-radius: 3px;"
      />

  @else
    -
  @endif

  @if( !empty($entry->{$column['name']}) )
    {$column['name']}) }}"
      target="_blank"
    >
      {$column['name']}) }}"
        style="
          max-height: {{ isset($column['height']) ? $column['height'] : "25px" }};
          width: {{ isset($column['width']) ? $column['width'] : "auto" }};
          border-radius: 3px;"
      />

  @else
    -
  @endif

Add improvements discussed on the PR

Add improvements discussed on the PR


<?php

  define('DB_HOST', '172.17.0.2');
  define('DB_USER', 'root');
  define('DB_PASSWORD', 'docker');
  define('DB_NAME', 'blog');

<?php

  define('DB_HOST', '127.0.0.1');
  define('DB_USER', 'root');
  define('DB_PASSWORD', 'root');
  define('DB_NAME', 'blog');

Remove docker, use good old PHP

Remove docker, use good old PHP


<?php

namespace SimplyTestable\WorkerBundle\Tests\Command\Task;

use SimplyTestable\WorkerBundle\Tests\Command\ConsoleCommandBaseTestCase;
use SimplyTestable\WorkerBundle\Entity\TimePeriod;

class ReportCompletionAllCommandTest extends ConsoleCommandBaseTestCase {

    public static function setUpBeforeClass() {
        self::setupDatabaseIfNotExists();
    }

    /**
     * @group standard
     */
    public function testReportCompletionAll() {
        $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath(__FUNCTION__ . '/HttpResponses')));

        $taskProperties = $this->createTask('http://example.com/', 'HTML validation');

        $task = $this->getTaskService()->getById($taskProperties->id);
        $taskTimePeriod = new TimePeriod();
        $taskTimePeriod->setStartDateTime(new \DateTime('1970-01-01'));
        $taskTimePeriod->setEndDateTime(new \DateTime('1970-01-02'));

        $task->setTimePeriod($taskTimePeriod);

        $this->createCompletedTaskOutputForTask($task);

        $response = $this->runConsole('simplytestable:task:reportcompletion:all');

        $this->assertEquals(0, $response);
    }

}

<?php

namespace SimplyTestable\WorkerBundle\Tests\Command\Task;

use SimplyTestable\WorkerBundle\Tests\Command\ConsoleCommandBaseTestCase;
use SimplyTestable\WorkerBundle\Entity\TimePeriod;

class ReportCompletionAllCommandTest extends ConsoleCommandBaseTestCase {

    public static function setUpBeforeClass() {
        self::setupDatabaseIfNotExists();
    }

    /**
     * @group standard
     */
    public function testReportCompletionAll() {
        $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath(__FUNCTION__ . '/HttpResponses')));
        $this->removeAllTasks();

        $taskProperties = $this->createTask('http://example.com/', 'HTML validation');

        $task = $this->getTaskService()->getById($taskProperties->id);
        $taskTimePeriod = new TimePeriod();
        $taskTimePeriod->setStartDateTime(new \DateTime('1970-01-01'));
        $taskTimePeriod->setEndDateTime(new \DateTime('1970-01-02'));

        $task->setTimePeriod($taskTimePeriod);

        $this->createCompletedTaskOutputForTask($task);

        $response = $this->runConsole('simplytestable:task:reportcompletion:all');

        $this->assertEquals(0, $response);
    }

}

Remove all tasks before testing report completion all


<?php

/**
 * @author Ben Rowe <ben.rowe.83@gmail.com>
 * @license    http://www.opensource.org/licenses/mit-license.html MIT License
 */

namespace Benrowe\Laravel\Config\Modifiers;

/**
 * Json modifier for Config
 *
 * @package Benrowe\Laravel\Config\Modifiers
 */
class Json implements Modifier
{
    /**
     * Determine if this value is json (array or object)
     *
     * @param  string $value
     * @return boolean
     */
    public function canHandleFrom($value)
    {
        return gettype($value) == 'array' || gettype($value) == 'object';
    }

    /**
     * Determine if we can convert this string into json
     * @param  string $value
     * @return boolean
     */
    public function canHandleTo($value)
    {
        return is_string($value) && in_array($value[0], ['[', '{']);
    }

    /**
     * Convert the string into the json object/array
     *
     * @param  string|array $value
     * @return mixed
     */
    public function convertTo($value)
    {
        return json_decode($value);
    }

    /**
     * Convert the complex object back to a string
     *
     * @param  mixed $value
     * @return string
     */
    public function convertFrom($value)
    {
        return json_encode($value);
    }
}

<?php

namespace Benrowe\Laravel\Config\Modifiers;

/**
 * Json modifier for Config
 *
 * @package Benrowe\Laravel\Config\Modifiers
 */
class Json implements Modifier
{
    /**
     * Determine if this value is json (array or object)
     *
     * @param  string $value
     * @return boolean
     */
    public function canHandleFrom($value)
    {
        return gettype($value) == 'array' || gettype($value) == 'object';
    }

    /**
     * Determine if we can convert this string into json
     * @param  string $value
     * @return boolean
     */
    public function canHandleTo($value)
    {
        return is_string($value) && in_array($value[0], ['[', '{']);
    }

    /**
     * Convert the string into the json object/array
     *
     * @param  string|array $value
     * @return mixed
     */
    public function convertTo($value)
    {
        return json_decode($value);
    }

    /**
     * Convert the complex object back to a string
     *
     * @param  mixed $value
     * @return string
     */
    public function convertFrom($value)
    {
        return json_encode($value);
    }
}

Remove file level docblock for json modifier


<?php

namespace Northstar\Providers;

use Northstar\Models\User;
use DoSomething\Gateway\Blink;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        User::creating(function (User $user) {
            // Set source automatically if not provided.
            $user->source = $user->source ?: client_id();
        });

        User::created(function (User $user) {
            // Send payload to Blink for Customer.io profile.
            if (config('features.blink')) {
                app(Blink::class)->userCreate($user->toBlinkPayload());
            }

            // Send metrics to StatHat.
            app('stathat')->ezCount('user created');
            app('stathat')->ezCount('user created - '.$user->source);
        });

        User::updating(function (User $user) {
            // Send payload to Blink for Customer.io profile.
            if (config('features.blink')) {
                app(Blink::class)->userCreate($user->toBlinkPayload());
            }

            // Write profile changes to the log, with redacted values for hidden fields.
            $changed = array_replace_keys($user->getDirty(), $user->getHidden(), '*****');
            logger('updated user', ['id' => $user->id, 'client_id' => client_id(), 'changed' => $changed]);
        });
    }

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

<?php

namespace Northstar\Providers;

use Northstar\Models\User;
use DoSomething\Gateway\Blink;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        User::creating(function (User $user) {
            // Set source automatically if not provided.
            $user->source = $user->source ?: client_id();
        });

        User::created(function (User $user) {
            // Send payload to Blink for Customer.io profile.
            if (config('features.blink')) {
                app(Blink::class)->userCreate($user->toBlinkPayload());
            }

            // Send metrics to StatHat.
            app('stathat')->ezCount('user created');
            app('stathat')->ezCount('user created - '.$user->source);
        });

        User::updating(function (User $user) {
            // Write profile changes to the log, with redacted values for hidden fields.
            $changed = array_replace_keys($user->getDirty(), $user->getHidden(), '*****');
            logger('updated user', ['id' => $user->id, 'client_id' => client_id(), 'changed' => $changed]);
        });

        User::updated(function (User $user) {
            // Send payload to Blink for Customer.io profile.
            if (config('features.blink')) {
                app(Blink::class)->userCreate($user->toBlinkPayload());
            }
        });
    }

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

Move Blink call into post-update event, not pre-update.


<?php

/*
 * This file is part of Cachet.
 *
 * (c) Cachet HQ <support@cachethq.io>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CachetHQ\Cachet\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('Illuminate\Contracts\Auth\Registrar', 'CachetHQ\Cachet\Services\Registrar');
    }
}

<?php

/*
 * This file is part of Cachet.
 *
 * (c) Cachet HQ <support@cachethq.io>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CachetHQ\Cachet\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @param \Illuminate\Bus\Dispatcher $dispatcher
     *
     * @return void
     */
    public function boot(Dispatcher $dispatcher)
    {
        $dispatcher->mapUsing(function ($command) {
            return Dispatcher::simpleMapping($command, 'CachetHQ\Cachet\Commands', 'CachetHQ\Cachet\Handlers\Commands');
        });
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('Illuminate\Contracts\Auth\Registrar', 'CachetHQ\Cachet\Services\Registrar');
    }
}

Deal with the command bus in the app service provider


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;

class RecruitingCampaignRecipient extends Model
{
    use SoftDeletes;
    use Notifiable;

    /**
     * Get the user that owns the phone.
     */
    public function recruitingCampaign()
    {
        return $this->belongsTo(\App\RecruitingCampaign::class);
    }

    /**
     * Get the user that owns the phone.
     */
    public function recruitingVisit()
    {
        return $this->belongsTo(\App\RecruitingVisit::class);
    }

    /**
     * Get the user that is related to the model.
     */
    public function user()
    {
        return $this->belongsTo(\App\User::class);
    }

    /**
     * Route notifications for the mail channel.
     *
     * @return string
     */
    public function routeNotificationForMail()
    {
        return $this->email_address;
    }

    /**
     * Get the visit token for the model.
     */
    public function getVisitToken()
    {
        return $this->recruitingVisit->visit_token ?: null;
    }
}

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;

class RecruitingCampaignRecipient extends Model
{
    use SoftDeletes;
    use Notifiable;

    /**
     * The attributes that are not mass assignable.
     *
     * @var array
     */
    protected $guarded = [
        'id',
        'created_at',
        'updated_at',
        'deleted_at'
    ];

    /**
     * Get the user that owns the phone.
     */
    public function recruitingCampaign()
    {
        return $this->belongsTo(\App\RecruitingCampaign::class);
    }

    /**
     * Get the user that owns the phone.
     */
    public function recruitingVisit()
    {
        return $this->belongsTo(\App\RecruitingVisit::class);
    }

    /**
     * Get the user that is related to the model.
     */
    public function user()
    {
        return $this->belongsTo(\App\User::class);
    }

    /**
     * Route notifications for the mail channel.
     *
     * @return string
     */
    public function routeNotificationForMail()
    {
        return $this->email_address;
    }

    /**
     * Get the visit token for the model.
     */
    public function getVisitToken()
    {
        return $this->recruitingVisit->visit_token ?: null;
    }
}

Add $guarded to allow mass assignment

Add $guarded to allow mass assignment


            Gilles Henrard

            <form class="navbar-form navbar-right">

                    <input type="text" placeholder="Email" class="form-control" />

                    <input type="password" placeholder="Password" class="form-control" />

              <button type="submit" class="btn btn-success">Connexion</button>
            </form>

                 HENRARD

            <form class="navbar-form navbar-right">

                    <input type="text" placeholder="Email" class="form-control" />

                    <input type="password" placeholder="Password" class="form-control" />

              <button type="submit" class="btn btn-success">Connexion</button>
            </form>

Add home icon to the nav bar

Add home icon to the nav bar


<?php

namespace Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Cache;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/** @ODM\Document */
class Collections
{
    /** @ODM\Id */
    public $id;

    /** @ODM\EmbedMany(collectionClass="SomeCollection") */
    public $coll;

    /** @ODM\ReferenceMany(collectionClass="SomeCollection") */
    public $refs;

    /** @ODM\EmbedMany(collectionClass="AnotherCollection") */
    public $another;
}

class SomeCollection extends ArrayCollection {}

class AnotherCollection extends ArrayCollection {}

<?php

namespace Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Cache;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/** @ODM\Document */
class Collections
{
    /** @ODM\Id */
    public $id;

    /** @ODM\EmbedMany(collectionClass=SomeCollection::class) */
    public $coll;

    /** @ODM\ReferenceMany(collectionClass=SomeCollection::class) */
    public $refs;

    /** @ODM\EmbedMany(collectionClass=AnotherCollection::class) */
    public $another;
}

class SomeCollection extends ArrayCollection {}

class AnotherCollection extends ArrayCollection {}

Use class constant for class names in annotation


<?php

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

namespace Sylius\Component\Core\Model;

use Sylius\Component\Inventory\Model\InventoryUnitInterface;
use Sylius\Component\Order\Model\OrderItemUnitInterface as BaseOrderItemUnitInterface;
use Sylius\Component\Shipping\Model\ShipmentUnitInterface;

/**
 * @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
 */
interface OrderItemUnitInterface extends BaseOrderItemUnitInterface, InventoryUnitInterface, ShipmentUnitInterface
{
    /**
     * @return int
     */
    public function getTaxTotal();
}

<?php

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

namespace Sylius\Component\Core\Model;

use Sylius\Component\Inventory\Model\InventoryUnitInterface;
use Sylius\Component\Order\Model\OrderItemUnitInterface as BaseOrderItemUnitInterface;
use Sylius\Component\Resource\Model\TimestampableInterface;
use Sylius\Component\Shipping\Model\ShipmentUnitInterface;

/**
 * @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
 */
interface OrderItemUnitInterface extends BaseOrderItemUnitInterface, InventoryUnitInterface, ShipmentUnitInterface
{
    /**
     * @return int
     */
    public function getTaxTotal();
}

[Inventory] Remove dependency on Resource component by removing usage of TimestampableInterface


<?php
/**
 * Particle.
 *
 * @link      http://github.com/particle-php for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Particle (http://particle-php.com)
 * @license   https://github.com/particle-php/Filter/blob/master/LICENSE New BSD License
 */
namespace Particle\Filter;

/**
 * Class Chain
 *
 * @package Particle\Filter
 */
class Chain
{
    /**
     * @var FilterRule[]
     */
    protected $rules;

    /**
     * Execute all filters in the chain
     *
     * @param bool $isSet
     * @param mixed $value
     * @return FilterResult
     */
    public function filter($isSet, $value = null)
    {
        /** @var FilterRule $rule */
        foreach ($this->rules as $rule) {
            if ($isSet || !$isSet && $rule->allowedNotSet()) {
                $value = $rule->filter($value);
                $isSet = true;
            }
        }

        return new FilterResult($isSet, $value);
    }

    /**
     * Add a new rule to the chain
     *
     * @param FilterRule $rule
     * @param string|null $encodingFormat
     * @return $this
     */
    public function addRule(FilterRule $rule, $encodingFormat)
    {
        $rule->setEncodingFormat($encodingFormat);

        $this->rules[] = $rule;

        return $this;
    }
}

<?php
/**
 * Particle.
 *
 * @link      http://github.com/particle-php for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Particle (http://particle-php.com)
 * @license   https://github.com/particle-php/Filter/blob/master/LICENSE New BSD License
 */
namespace Particle\Filter;

/**
 * Class Chain
 *
 * @package Particle\Filter
 */
class Chain
{
    /**
     * @var FilterRule[]
     */
    protected $rules;

    /**
     * Execute all filters in the chain
     *
     * @param bool $isSet
     * @param mixed $value
     * @return FilterResult
     */
    public function filter($isSet, $value = null)
    {
        /** @var FilterRule $rule */
        foreach ($this->rules as $rule) {
            if ($isSet || $rule->allowedNotSet()) {
                $value = $rule->filter($value);
                $isSet = true;
            }
        }

        return new FilterResult($isSet, $value);
    }

    /**
     * Add a new rule to the chain
     *
     * @param FilterRule $rule
     * @param string|null $encodingFormat
     * @return $this
     */
    public function addRule(FilterRule $rule, $encodingFormat)
    {
        $rule->setEncodingFormat($encodingFormat);

        $this->rules[] = $rule;

        return $this;
    }
}

Remove unnessesairy check in if statement


<?php

namespace FluxBB\Server\Response;

use FluxBB\Server\Request;
use Illuminate\Support\Contracts\MessageProviderInterface;
use Illuminate\Support\MessageBag;

class Error extends Redirect implements MessageProviderInterface
{
    protected $errors;

    public function __construct(Request $next, MessageBag $errors)
    {
        parent::__construct($next);
        $this->errors = $errors;
    }

    public function getErrors()
    {
        return $this->errors;
    }

    public function accept(HandlerInterface $handler)
    {
        return $handler->handleErrorResponse($this);
    }

    /**
     * Get the messages for the instance.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getMessageBag()
    {
        $this->getErrors();
    }
}

<?php

namespace FluxBB\Server\Response;

use FluxBB\Server\Request;
use Illuminate\Support\Contracts\MessageProviderInterface;
use Illuminate\Support\MessageBag;

class Error extends Redirect implements MessageProviderInterface
{
    protected $errors;

    public function __construct(Request $next, MessageBag $errors)
    {
        parent::__construct($next);
        $this->errors = $errors;
    }

    public function getErrors()
    {
        return $this->errors;
    }

    public function accept(HandlerInterface $handler)
    {
        return $handler->handleErrorResponse($this);
    }

    /**
     * Get the messages for the instance.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getMessageBag()
    {
        return $this->getErrors();
    }
}

Fix error response not returning errors.


@extends('layouts.default')

@section('content')
  @foreach ($speakers as $index => $speaker)

{{ $speaker['date'] }} - {{ $speaker['name'] }}

      {{ $speaker['view'] }}
    @if ($index == 11)
      <?php echo $speakers->links(); ?>

    @else

    @endif

  @endforeach

@endsection

@extends('layouts.default')

@section('title')
Past Speakers · Indiana Real Estate Exchangors, Inc.
@stop

@section('content')
  @foreach ($speakers as $index => $speaker)

{{ $speaker['date'] }} - {{ $speaker['name'] }}

      {{ $speaker['view'] }}
    @if ($index == 11)
      <?php echo $speakers->links(); ?>

    @else

    @endif

  @endforeach

@endsection

Change the title of the past speakers page for tracking purposes.


<?php

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

namespace Surfnet\ServiceProviderDashboard\Application\CommandHandler\Entity;

use Surfnet\ServiceProviderDashboard\Application\Command\Entity\UpdateEntityStatusCommand;
use Surfnet\ServiceProviderDashboard\Application\CommandHandler\CommandHandler;
use Surfnet\ServiceProviderDashboard\Domain\Repository\EntityRepository;

/**
 * Updates the entity status and clears the comments set on the entity.
 */
class UpdateEntityStatusCommandHandler implements CommandHandler
{
    /**
     * @var EntityRepository
     */
    private $repository;

    public function __construct(EntityRepository $entityRepository)
    {
        $this->repository = $entityRepository;
    }

    public function handle(UpdateEntityStatusCommand $command)
    {
        $entity = $this->repository->findById($command->getId());

        $entity->setStatus($command->getStatus());

        $this->repository->save($entity);
    }
}

<?php

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

namespace Surfnet\ServiceProviderDashboard\Application\CommandHandler\Entity;

use Surfnet\ServiceProviderDashboard\Application\Command\Entity\UpdateEntityStatusCommand;
use Surfnet\ServiceProviderDashboard\Application\CommandHandler\CommandHandler;
use Surfnet\ServiceProviderDashboard\Domain\Repository\EntityRepository;

/**
 * Updates the entity status and clears the comments set on the entity.
 */
class UpdateEntityStatusCommandHandler implements CommandHandler
{
    /**
     * @var EntityRepository
     */
    private $repository;

    public function __construct(EntityRepository $entityRepository)
    {
        $this->repository = $entityRepository;
    }

    public function handle(UpdateEntityStatusCommand $command)
    {
        $entity = $this->repository->findById($command->getId());

        $entity->setStatus($command->getStatus());
        $entity->setComments('');

        $this->repository->save($entity);
    }
}

Clear comments when changing the entity status


<?php

$url = 'http://bidfta.bidqt.com/BidFTA/services/invoices/queryExecutor/queries/FTALocations?size=50';

//Encode POST values
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

//CURL request
$ch = curl_init();
           curl_setopt($ch, CURLOPT_URL, $url);
           curl_setopt($ch, CURLOPT_HEADER, FALSE);

           curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
           curl_setopt($ch,CURLOPT_HTTPHEADER,array('Origin: http://bidfta.bidqt.com','Referer: http://bidfta.bidqt.com','X-Requested-With: XMLHttpRequest'));
           $head = curl_exec($ch);
           $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
           curl_close($ch);

echo $head;

 ?>

<?php

$url = 'http://bidfta.bidqt.com/BidFTA/services/invoices/queryExecutor/queries/FTALocations?size=100';

//CURL request
$ch = curl_init();
           curl_setopt($ch, CURLOPT_URL, $url);
           curl_setopt($ch, CURLOPT_HEADER, FALSE);

           curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
           curl_setopt($ch,CURLOPT_HTTPHEADER,array('Origin: http://bidfta.bidqt.com','Referer: http://bidfta.bidqt.com','X-Requested-With: XMLHttpRequest'));
           $head = curl_exec($ch);
           $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
           curl_close($ch);

echo $head;

 ?>

Remove input POST encoding loop

Remove input POST encoding loop

It caused a warning that read directly into JSON.parse(data) and
appeared to be unnecessary.


<?php
class DeviceController extends \BaseController {

	/**
	 * Връща JSON със данните от API-то
	 *
	 * @return Response
	 */
	public function index()
	{
		$Settings = Settings::orderBy('created_at','desc')->first();
		if(count($Settings) == 0){
			return Response::json("Няма намерени ресурси, моля отидете на менюто: Настройки");
		}else{
			return Response::json(json_decode(file_get_contents($Settings['api'])));
		}
	}

}

<?php
class DeviceController extends \BaseController {

	/**
	 * Връща JSON със данните от API-то
	 *
	 * @return Response
	 */
	public function index()
	{
		$Settings = Settings::orderBy('created_at','desc')->first();
		if(count($Settings) == 0){
			return Response::json("Няма намерени ресурси, моля отидете на менюто: Настройки");
		}else{
				$result = json_decode(file_get_contents($Settings['api']));

				$this->processNewData($result);
				return Response::json($result);
		}
	}

	public function processNewData($result){
				for ($i=0; $i < count($result->devices); $i++) {
					if (Device::where('name','=',$result->devices[$i]->name)->count()) {
						$deviceTemp = Device::where('name','=',$result->devices[$i]->name)->first();
						$newValue = new Value(array('value' => $result->devices[$i]->value));
						$save = $deviceTemp->values()->save($newValue);
					}
				}
	}

}

Add new Method to procces new data and save it to database


<?php

namespace BetterReflection\TypesFinder;

use PhpParser\Node\Stmt\Property as PropertyNode;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\Types\ContextFactory;
use BetterReflection\Reflection\ReflectionProperty;

class FindPropertyType
{
    /**
     * Given a property, attempt to find the type of the property
     *
     * @param PropertyNode $node
     * @param ReflectionProperty $reflectionProperty
     * @return Type[]
     */
    public function __invoke(PropertyNode $node, ReflectionProperty $reflectionProperty)
    {
        $contextFactory = new ContextFactory();
        $context = $contextFactory->createFromReflector($reflectionProperty);

        /* @var \PhpParser\Comment\Doc $comment */
        if (!$node->hasAttribute('comments')) {
            return [];
        }
        $comment = $node->getAttribute('comments')[0];
        $docBlock = new DocBlock(
            $comment->getReformattedText(),
            new DocBlock\Context(
                $reflectionProperty->getDeclaringClass()->getNamespaceName()
            )
        );

        /* @var \phpDocumentor\Reflection\DocBlock\Tag\VarTag $varTag */
        $varTag = $docBlock->getTagsByName('var')[0];
        return (new ResolveTypes())->__invoke($varTag->getTypes(), $context);
    }
}

<?php

namespace BetterReflection\TypesFinder;

use PhpParser\Node\Stmt\Property as PropertyNode;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\Types\ContextFactory;
use BetterReflection\Reflection\ReflectionProperty;

class FindPropertyType
{
    /**
     * Given a property, attempt to find the type of the property
     *
     * @param PropertyNode $node
     * @param ReflectionProperty $reflectionProperty
     * @return Type[]
     */
    public function __invoke(PropertyNode $node, ReflectionProperty $reflectionProperty)
    {
        $contextFactory = new ContextFactory();
        $context = $contextFactory->createFromReflector($reflectionProperty);

        /* @var \PhpParser\Comment\Doc $comment */
        if (!$node->hasAttribute('comments')) {
            return [];
        }
        $comment = $node->getAttribute('comments')[0];
        $docBlock = new DocBlock(
            $comment->getReformattedText(),
            new DocBlock\Context(
                $reflectionProperty->getDeclaringClass()->getNamespaceName()
            )
        );

        /* @var \phpDocumentor\Reflection\DocBlock\Tag\VarTag $varTag */
        $resolvedTypes = [];
        $varTags = $docBlock->getTagsByName('var');
        foreach ($varTags as $varTag) {
            $resolvedTypes = array_merge(
                $resolvedTypes,
                (new ResolveTypes())->__invoke($varTag->getTypes(), $context)
            );
        }
        return $resolvedTypes;
    }
}

Support multiple @var tags and also no @var tags at all


<?php

namespace App\Contracts;

use Illuminate\Support\Collection;

interface CollectsScanOutput
{
    /**
     * Get the Asset related data as a Collection
     *
     * @return Collection
     */
    function exportForAsset(): Collection;

    /**
     * Get the Vulnerability related data as a Collection
     *
     * @return Collection
     */
    function exportForVulnerability(): Collection;

    /**
     * Get the Vulnerability Reference related data as a Collection
     *
     * @return Collection
     */
    function exportForVulnerabilityReference(): Collection;

    /**
     * Get the System Information related data as a Collection
     *
     * @return Collection
     */
    function exportOpenPorts(): Collection;
}

<?php

namespace App\Contracts;

use Illuminate\Support\Collection;

interface CollectsScanOutput
{
    /**
     * Get the Asset related data as a Collection
     *
     * @return Collection
     */
    public function exportForAsset(): Collection;

    /**
     * Get the Vulnerability related data as a Collection
     *
     * @return Collection
     */
    public function exportForVulnerability(): Collection;

    /**
     * Get the Vulnerability Reference related data as a Collection
     *
     * @return Collection
     */
    public function exportForVulnerabilityReference(): Collection;

    /**
     * Get the System Information related data as a Collection
     *
     * @return Collection
     */
    public function exportOpenPorts(): Collection;

    /**
     * Get the Software Information data as a Collection
     *
     * @return Collection
     */
    public function exportSoftwareInformation(): Collection;
}

Include exportSoftwareInformation() method in the contract


<?php
namespace Craft;

use Cake\Utility\Hash as Hash;

class TableFeedMeFieldType extends BaseFeedMeFieldType
{
    // Templates
    // =========================================================================

    public function getMappingTemplate()
    {
        return 'feedme/_includes/fields/table';
    }

    // Public Methods
    // =========================================================================

    public function prepFieldData($element, $field, $fieldData, $handle, $options)
    {
        $preppedData = array();

        $data = Hash::get($fieldData, 'data');

        if (empty($data)) {
            return array();
        }

        /*foreach (Hash::flatten($data) as $key => $value) {
            preg_match('/^(col\d+)/', $key, $matches);

            if (isset($matches[1]) && $matches[1] != '') {
                $index = $matches[1];
            } else {
                $index = 0;
            }

            $parsedData[$index][] = $value;
        }*/

        if (Hash::dimensions($data) == 2) {
            $data = array($data);
        }

        foreach ($data as $i => $row) {
            foreach ($row as $j => $column) {
                // Check for false for checkbox
                if ($column['data'] === 'false') {
                    $column['data'] = null;
                }

                $preppedData[($i)][$j] = $column['data'];
            }
        }

        return $preppedData;
    }

}

<?php
namespace Craft;

use Cake\Utility\Hash as Hash;

class TableFeedMeFieldType extends BaseFeedMeFieldType
{
    // Templates
    // =========================================================================

    public function getMappingTemplate()
    {
        return 'feedme/_includes/fields/table';
    }

    // Public Methods
    // =========================================================================

    public function prepFieldData($element, $field, $fieldData, $handle, $options)
    {
        $preppedData = array();

        $data = Hash::get($fieldData, 'data');

        if (empty($data)) {
            return array();
        }

        /*foreach (Hash::flatten($data) as $key => $value) {
            preg_match('/^(col\d+)/', $key, $matches);

            if (isset($matches[1]) && $matches[1] != '') {
                $index = $matches[1];
            } else {
                $index = 0;
            }

            $parsedData[$index][] = $value;
        }*/

        if (Hash::dimensions($data) == 2) {
            $data = array($data);
        }

        foreach ($data as $i => $row) {
            if (isset($row['data'])) {
                $row = $row['data'];
            }

            foreach ($row as $j => $column) {
                if (!isset($column['data'])) {
                    $column = array('data' => $column);
                }

                // Check for false for checkbox
                if ($column['data'] === 'false') {
                    $column['data'] = null;
                }

                $preppedData[($i)][$j] = $column['data'];
            }
        }

        return $preppedData;
    }

}

Fix for Table field in Matrix

Fix for Table field in Matrix


<?php

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

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Context;

use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Locale\Context\LocaleContextInterface;
use Sylius\Component\Locale\Context\LocaleNotFoundException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

/**
 * @author Jan Góralski <jan.goralski@lakion.com>
 */
final class AdminBasedLocaleContext implements LocaleContextInterface
{
    /**
     * @var TokenStorageInterface
     */
    private $tokenStorage;

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

    /**
     * {@inheritdoc}
     */
    public function getLocaleCode()
    {
        $token = $this->tokenStorage->getToken();
        if (null === $token) {
            throw new LocaleNotFoundException();
        }

        $user = $token->getUser();
        if (!$user instanceof AdminUserInterface) {
            throw new LocaleNotFoundException();
        }

        return $user->getLocaleCode();
    }
}

<?php

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

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Context;

use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Locale\Context\LocaleContextInterface;
use Sylius\Component\Locale\Context\LocaleNotFoundException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

/**
 * @author Jan Góralski <jan.goralski@lakion.com>
 */
final class AdminBasedLocaleContext implements LocaleContextInterface
{
    /**
     * @var TokenStorageInterface
     */
    private $tokenStorage;

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

    /**
     * {@inheritdoc}
     */
    public function getLocaleCode(): string
    {
        $token = $this->tokenStorage->getToken();
        if (null === $token) {
            throw new LocaleNotFoundException();
        }

        $user = $token->getUser();
        if (!$user instanceof AdminUserInterface) {
            throw new LocaleNotFoundException();
        }

        return $user->getLocaleCode();
    }
}

Adjust to scalar types introduced in Locale component & bundle


<?php

namespace BitWasp\Bitcoin\Tests\Transaction;

class TransactionInputStateTest {

}

<?php

namespace BitWasp\Bitcoin\Tests\Transaction;

use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Crypto\EcAdapter\EcAdapterFactory;
use BitWasp\Bitcoin\Key\PrivateKeyFactory;
use BitWasp\Bitcoin\Script\ScriptFactory;
use BitWasp\Bitcoin\Tests\AbstractTestCase;
use BitWasp\Bitcoin\Transaction\TransactionBuilderInputState;

class TransactionInputStateTest extends AbstractTestCase
{
    public function getRedeemScript()
    {
        $script = ScriptFactory::multisig(2, [
            PrivateKeyFactory::create()->getPublicKey(),
            PrivateKeyFactory::create()->getPublicKey(),
            PrivateKeyFactory::create()->getPublicKey()
        ]);

        return $script;
    }

    public function getOutputScript()
    {
        $script = ScriptFactory::scriptPubKey()
            ->payToAddress(PrivateKeyFactory::create()->getAddress());

        return $script;
    }

    public function testCreateState()
    {
        $math = Bitcoin::getMath();
        $G = Bitcoin::getGenerator();
        $ecAdapter = EcAdapterFactory::getAdapter($math, $G);
        $rs = $this->getRedeemScript();
        $outputScript = $rs->getOutputScript();

        $state = new TransactionBuilderInputState($ecAdapter, $outputScript, $rs);
        $this->assertSame($outputScript, $state->getPrevOutScript());
        $this->assertSame($rs, $state->getRedeemScript());
    }
}

Add initial test of TransactionBuilderInputState


<?php
/**
 * Created by PhpStorm.
 * User: rahman
 * Date: 11/4/14
 * Time: 5:09 AM
 */

Validator::extend('must_alpha_num', function($attribute, $value, $parameters)
{
    return !is_numeric($value);
});

<?php
/**
 * Created by PhpStorm.
 * User: rahman
 * Date: 11/4/14
 * Time: 5:09 AM
 */

Validator::extend('must_alpha_num', function($attribute, $value, $parameters)
{
    $ret = FALSE;
    if (preg_match("/^[A-Za-z][A-Za-z0-9]{5,31}$/", $value)) {
        $ret = TRUE;
    }
    return $ret;
});

Fix username validation alphanumeric only


<?php

return [
	'database' => [
		'driver'    => 'mysql',
		'host'      => 'localhost',
		'database'  => 'flarum',
		'username'  => 'root',
		'password'  => 'root',
		'charset'   => 'utf8',
		'collation' => 'utf8_unicode_ci',
		'prefix'    => '',
		'strict'    => false
	]
];

<?php

return [
	'debug'    => true,
	'database' => [
		'driver'    => 'mysql',
		'host'      => 'localhost',
		'database'  => 'flarum',
		'username'  => 'root',
		'password'  => 'root',
		'charset'   => 'utf8',
		'collation' => 'utf8_unicode_ci',
		'prefix'    => '',
		'strict'    => false
	]
];

Add debug flag to config file

Add debug flag to config file


<?php

/**
 * ownCloud - ImgCrawl
 *
 * @author Ackinty Strappa <ackinty@gmail.com>
 * @copyright 2014 Ackinty
 * @license This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
 */

namespace OCA\ImgCrawl\Controller;

use \OCP\AppFramework\APIController;
use \OCP\AppFramework\Http\JSONResponse;
use \OCP\IRequest;
use \OCP\IConfig;

class ImgCrawlAPIController extends APIController {

    protected $imgCrawlService;

    public function __construct($appName, IRequest $request, ImgCrawlService $imgCrawlService){
        parent::__construct($appName, $request, 'GET');

        $this->imgCrawlService = $imgCrawlService;
    }

    /**
     * Returns informations from history
     * @NoCSRFRequired
     * @CORS
     */
    public function index() {
        $images = array();

        try {
            $images = $this->imgCrawlService->imgCrawl();
        } catch (Exception $e) {
            $response = new JSONResponse();
            return $response->setStatus(\OCA\AppFramework\Http::STATUS_NOT_FOUND);
        }

        if (empty($images)) {
            $response = new JSONResponse();
            return $response->setStatus(\OCA\AppFramework\Http::STATUS_NOT_FOUND);
        }

        return new JSONResponse($images);
    }

}

<?php

/**
 * ownCloud - ImgCrawl
 *
 * @author Ackinty Strappa <ackinty@gmail.com>
 * @copyright 2014 Ackinty
 * @license This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
 */

namespace OCA\ImgCrawl\Controller;

use \OCP\AppFramework\APIController;
use \OCP\AppFramework\Http\JSONResponse;
use \OCP\IRequest;
use \OCP\IConfig;

class ImgCrawlAPIController extends APIController {

    protected $imgCrawlService;

    public function __construct($appName, IRequest $request, ImgCrawlService $imgCrawlService){
        parent::__construct($appName, $request, 'GET');

        $this->imgCrawlService = $imgCrawlService;
    }

    /**
     * Returns list of imgs
     * @NoCSRFRequired
     * @CORS
     */
    public function index() {
        $images = array();

        try {
            $images = $this->imgCrawlService->imgCrawl();
        } catch (Exception $e) {
            $response = new JSONResponse();
            return $response->setStatus(\OCP\AppFramework\Http::STATUS_NOT_FOUND);
        }

        if (empty($images)) {
            $response = new JSONResponse();
            return $response->setStatus(\OCP\AppFramework\Http::STATUS_NOT_FOUND);
        }

        return new JSONResponse($images);
    }

}

Fix typo (OCA => OCP)

Fix typo (OCA => OCP)


<?php
/**
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE file
 * Redistributions of files must retain the above copyright notice.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/mit-license.php
 *
 *
 * @copyright Copyright (c) Mikaël Capelle (https://typename.fr)
 * @license https://opensource.org/licenses/mit-license.php MIT License
 */
namespace Bootstrap\View\Helper;

use Cake\View\Helper\BreadcrumbsHelper;

class BootstrapBreadcrumbsHelper extends BreadcrumbsHelper {

    /**
     * Default config for the helper.
     *
     * @var array
     */
    protected $_defaultConfig = [
        'templates' => [
            'wrapper' => '
{{content}}
',
            'item' => '
{{title}}
',
            'itemWithoutLink' => '
{{title}}
',
            'separator' => ''
        ],
        'templateClass' => 'Bootstrap\View\BootstrapStringTemplate'
    ];

};

Remove extra quote from template in BreadcrumbsHelper.


<?php
namespace BryanCrowe\ApiPagination\Test;

use BryanCrowe\ApiPagination\Controller\Component\ApiPaginationComponent;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Core\Plugin;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\TestSuite\TestCase;

/**
 * ApiPaginationComponentTest class
 */
class ApiPaginationComponentTest extends TestCase
{
    /**
     * setUp method
     *
     * @return void
     */
    public function setUp()
    {
        parent::setUp();
    }

    /**
     * tearDown method
     *
     * @return void
     */
    public function tearDown()
    {
        parent::tearDown();

        unset($this->component, $this->controller);
    }

    public function testInit()
    {
        $request = new Request('/');
        $response = $this->getMock('Cake\Network\Response');

        $controller = new Controller($request, $response);
        $controller->loadComponent('BryanCrowe/ApiPagination.ApiPagination');

        $expected = [
            'key' => 'pagination',
            'aliases' => [],
            'visible' => []
        ];

        $result = $controller->ApiPagination->config();

        $this->assertSame($expected, $result);
    }
}

<?php
namespace BryanCrowe\ApiPagination\Test;

use BryanCrowe\ApiPagination\Controller\Component\ApiPaginationComponent;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Core\Plugin;
use Cake\Event\Event;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\TestSuite\TestCase;

/**
 * ApiPaginationComponentTest class
 */
class ApiPaginationComponentTest extends TestCase
{
    /**
     * setUp method
     *
     * @return void
     */
    public function setUp()
    {
        parent::setUp();
    }

    /**
     * tearDown method
     *
     * @return void
     */
    public function tearDown()
    {
        parent::tearDown();
    }

    public function testNonApiPaginatedRequest()
    {
        $request = new Request('/');
        $response = $this->getMock('Cake\Network\Response');
        $controller = new Controller($request, $response);
        $apiPaginationComponent = new ApiPaginationComponent($controller->components());
        $event = new Event('Controller.beforeRender', $controller);

        $this->assertNull($apiPaginationComponent->beforeRender($event));
    }
}

Remove old test code, test non API paginated request early return


<?php

namespace Mockery\Generator;

class DefinedTargetClass
{
    private $rfc;

    public function __construct(\ReflectionClass $rfc)
    {
        $this->rfc = $rfc;
    }

    public static function factory($name)
    {
        return new static(new \ReflectionClass($name));
    }

    public function getName()
    {
        return $this->rfc->getName();
    }

    public function isAbstract()
    {
        return $this->rfc->isAbstract();
    }

    public function isFinal()
    {
        return $this->rfc->isFinal();
    }

    public function getMethods()
    {
        return array_map(function ($method) {
            return new Method($method);
        }, $this->rfc->getMethods());
    }

    public function getInterfaces()
    {
        return array_map(function ($interface) {
            return new static($interface);
        }, $this->rfc->getInterfaces());
    }

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

    public function getNamespaceName()
    {
        return $this->rfc->getNamespaceName();
    }

    public function inNamespace()
    {
        return $this->rfc->inNamespace();
    }

    public function getShortName()
    {
        return $this->rfc->getShortName();
    }
}

<?php

namespace Mockery\Generator;

class DefinedTargetClass
{
    private $rfc;

    public function __construct(\ReflectionClass $rfc)
    {
        $this->rfc = $rfc;
    }

    public static function factory($name)
    {
        return new self(new \ReflectionClass($name));
    }

    public function getName()
    {
        return $this->rfc->getName();
    }

    public function isAbstract()
    {
        return $this->rfc->isAbstract();
    }

    public function isFinal()
    {
        return $this->rfc->isFinal();
    }

    public function getMethods()
    {
        return array_map(function ($method) {
            return new Method($method);
        }, $this->rfc->getMethods());
    }

    public function getInterfaces()
    {
        return array_map(function ($interface) {
            return new self($interface);
        }, $this->rfc->getInterfaces());
    }

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

    public function getNamespaceName()
    {
        return $this->rfc->getNamespaceName();
    }

    public function inNamespace()
    {
        return $this->rfc->inNamespace();
    }

    public function getShortName()
    {
        return $this->rfc->getShortName();
    }
}

Use self for php 5.3

Use self for php 5.3


<?php

namespace ApiBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\RestBundle\Controller\Annotations\View;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Doctrine\ORM\Entity\Repository;
use AppBundle\Entity\Report;

class ReportRestController extends Controller
{
   /**
     * @return array
     * @View()
    */
    public function getReportsAction()
    {
        $repository = $this->getDoctrine()->getManager()->getRepository('AppBundle:Report');

        // Get all reports
        $reports = $repository->findAll();

        return $reports;
    }
}

<?php

namespace ApiBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\RestBundle\Controller\Annotations\View;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Doctrine\ORM\Entity\Repository;
use AppBundle\Entity\Report;

class ReportRestController extends Controller
{
   /**
     * @return array
     * @View()
    */
    public function getReportsAction()
    {
        $repository = $this->getDoctrine()->getManager()->getRepository('AppBundle:Report');

        // Get all reports
        $reports = $repository->findBy(array(), array('date' => 'DESC'), 30);

        return $reports;
    }
}

Add filters to the report request

Add filters to the report request


<?php

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

class CreateTranslationTranslationTranslationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('translation__translation_translations', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('value');

            $table->integer('translation_id')->unsigned();
            $table->string('locale')->index();
            $table->unique(['translation_id', 'locale'], 'translations_trans_id_locale_unique');
            $table->foreign('translation_id' )->references('id')->on('translation__translations')->onDelete('cascade');
        });
    }

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

<?php

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

class CreateTranslationTranslationTranslationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('translation__translation_translations', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->text('value');

            $table->integer('translation_id')->unsigned();
            $table->string('locale')->index();
            $table->unique(['translation_id', 'locale'], 'translations_trans_id_locale_unique');
            $table->foreign('translation_id' )->references('id')->on('translation__translations')->onDelete('cascade');
        });
    }

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

Update the column type of the value field


<?php

/*
* This file is part of the Integrated package.
*
* (c) e-Active B.V. <integrated@e-active.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Integrated\Bundle\SolrBundle\DependencyInjection;

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

/**
 * Configuration class for SolrBundle
 *
 * @author Jeroen van Leeuwen <jeroen@e-active.nl>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $builder = new TreeBuilder;
        $builder->root('integrated_solr')
            ->children()
            ->arrayNode('endpoints')
            ->prototype('array')
            ->children()
            ->scalarNode('host')->defaultValue('localhost')->end()
            ->scalarNode('port')->defaultValue(8983)->end()
            ->scalarNode('path')->defaultValue('/solr')->end()
            ->scalarNode('core')->end()
            ->scalarNode('timeout')->defaultValue(5)->end()
            ->end()
            ->end()
            ->end()
            ->end();

        return $builder;
    }
}

<?php

/*
* This file is part of the Integrated package.
*
* (c) e-Active B.V. <integrated@e-active.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Integrated\Bundle\SolrBundle\DependencyInjection;

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

/**
 * Configuration class for SolrBundle
 *
 * @author Jeroen van Leeuwen <jeroen@e-active.nl>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $builder = new TreeBuilder;
        $builder->root('integrated_solr')
            ->children()
            ->arrayNode('endpoints')
            ->prototype('array')
            ->children()
            ->scalarNode('scheme')->defaultValue('http')->end()
            ->scalarNode('host')->defaultValue('localhost')->end()
            ->scalarNode('port')->defaultValue(8983)->end()
            ->scalarNode('username')->defaultValue(null)->end()
            ->scalarNode('password')->defaultValue(null)->end()
            ->scalarNode('path')->defaultValue('/solr')->end()
            ->scalarNode('core')->end()
            ->scalarNode('timeout')->defaultValue(5)->end()
            ->end()
            ->end()
            ->end()
            ->end();

        return $builder;
    }
}

Allow username, password and scheme for solr


<?php
error_reporting(E_ALL);

require_once dirname(__DIR__) . '/vendor/autoload.php';

PHPUnit_Framework_Error_Notice::$enabled = true;

<?php
error_reporting(E_ALL);

if(is_file(dirname(__DIR__) . '/vendor/autoload.php')) {
    require_once dirname(__DIR__) . '/vendor/autoload.php';
}
elseif(is_file(dirname(dirname(__DIR__)) . '/common/code/Data.php')) {
    require_once dirname(dirname(__DIR__)) . '/common/code/Data.php';
    require_once dirname(__DIR__) . '/code/Calendar.php';
}

PHPUnit_Framework_Error_Notice::$enabled = true;

Allow executing tests without composer

Allow executing tests without composer

...quite dirty but handy while developing ;)


<?php

require_once(dirname(__FILE__).'/../vendor/simpletest/autorun.php');
require_once(dirname(__FILE__).'/../Mustache.php');

class MustacheTestSuite extends TestSuite {
  function MustacheTestSuite() {
    $this->TestSuite('All Mustache tests');
    $this->addFile("tests/testStringScanner.php");
    $this->addFile("tests/testMustache.php");
    $this->addFile("tests/testContext.php");
  }
};

?>

<?php

require_once(dirname(__FILE__).'/../vendor/simpletest/autorun.php');
require_once(dirname(__FILE__).'/../Mustache.php');

class MustacheTestSuite extends TestSuite {
  function MustacheTestSuite() {
    $this->TestSuite('All Mustache tests');
    $this->addFile("tests/testStringScanner.php");
    $this->addFile("tests/testMustache.php");
    $this->addFile("tests/testContext.php");
    $this->addFile("tests/testParser.php");
  }
};

?>

Add parser tests to suite

Add parser tests to suite


<?php

require 'vendor/autoload.php'; # Generated by composer
require __DIR__.'/src/Lce/Bootstrap.php';
\Lce\Bootstrap::init();

<?php

require __DIR__.'/vendor/autoload.php'; # Generated by composer
require __DIR__.'/src/Lce/Bootstrap.php';
\Lce\Bootstrap::init();

Make require more robust for loads in complex contexts


<?php
/**
 * @link      https://github.com/zendframework/zend-modulemanager for the canonical source repository
 * @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (https://www.zend.com)
 * @license   https://github.com/zendframework/zend-modulemanager/blob/master/LICENSE.md New BSD License
 */

namespace ZendTest\ModuleManager;

/**
 * Offer common setUp/tearDown methods for configure a common cache dir.
 */
trait SetUpCacheDirTrait
{
    /**
     * @var string
     */
    protected $tmpdir;

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

    /**
     * @before
     */
    protected function createTmpDir()
    {
        $this->tmpdir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'zend_module_cache_dir';
        @mkdir($this->tmpdir);

        $this->configCache = $this->tmpdir . DIRECTORY_SEPARATOR . 'config.cache.php';
    }

    /**
     * @after
     */
    protected function removeTmpDir()
    {
        $file = glob($this->tmpdir . DIRECTORY_SEPARATOR . '*');
        @unlink($file[0]); // change this if there's ever > 1 file
        @rmdir($this->tmpdir);
    }
}

<?php
/**
 * @link      https://github.com/zendframework/zend-modulemanager for the canonical source repository
 * @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (https://www.zend.com)
 * @license   https://github.com/zendframework/zend-modulemanager/blob/master/LICENSE.md New BSD License
 */

namespace ZendTest\ModuleManager;

/**
 * Offer common setUp/tearDown methods for configure a common cache dir.
 */
trait SetUpCacheDirTrait
{
    /**
     * @var string
     */
    protected $tmpdir;

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

    /**
     * @before
     */
    protected function createTmpDir()
    {
        $this->tmpdir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'zend_module_cache_dir';
        @mkdir($this->tmpdir);

        $this->configCache = $this->tmpdir . DIRECTORY_SEPARATOR . 'config.cache.php';
    }

    /**
     * @after
     */
    protected function removeTmpDir()
    {
        $file = glob($this->tmpdir . DIRECTORY_SEPARATOR . '*');
        if (isset($file[0])) {
            // change this if there's ever > 1 file
            @unlink($file[0]);
        }
        @rmdir($this->tmpdir);
    }
}

Fix clearing temporary files in tests

Fix clearing temporary files in tests


<?php

namespace Yajra\Acl\Models;

use Illuminate\Database\Eloquent\Model;
use Yajra\Acl\Traits\HasPermission;

/**
 * @property \Yajra\Acl\Models\Permission permissions
 * @property bool system
 */
class Role extends Model
{
    use HasPermission;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'roles';

    /**
     * Fillable fields.
     *
     * @var array
     */
    protected $fillable = ['name', 'slug', 'description', 'system'];

    protected static function boot()
    {
        parent::boot();

        static::saved(function () {
            app('cache.store')->forget('permissions.policies');
        });

        static::deleted(function () {
            app('cache.store')->forget('permissions.policies');
        });
    }

    /**
     * Roles can belong to many users.
     *
     * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function users()
    {
        return $this->belongsToMany(config('acl.user', config('auth.providers.users.model')))
                    ->withTimestamps();
    }
}

<?php

namespace Yajra\Acl\Models;

use Illuminate\Database\Eloquent\Model;
use Yajra\Acl\Traits\HasPermission;

/**
 * @property \Yajra\Acl\Models\Permission permissions
 * @property bool system
 */
class Role extends Model
{
    use HasPermission;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'roles';

    /**
     * Fillable fields.
     *
     * @var array
     */
    protected $fillable = ['name', 'slug', 'description', 'system'];

    protected static function boot()
    {
        parent::boot();

        static::saved(function () {
            app('cache.store')->forget(config('acl.cache.key', 'permissions.policies'));
        });

        static::deleted(function () {
            app('cache.store')->forget(config('acl.cache.key', 'permissions.policies'));
        });
    }

    /**
     * Roles can belong to many users.
     *
     * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function users()
    {
        return $this->belongsToMany(config('acl.user', config('auth.providers.users.model')))
                    ->withTimestamps();
    }
}

Resolve cache key from config.

Resolve cache key from config.


<?php

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

namespace Sylius\Component\Core\Locale;

use Sylius\Component\Core\Channel\ChannelContextInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Component\Locale\Provider\LocaleProviderInterface;

/**
 * Locale provider, which returns locales enabled for this channel.
 *
 * @author Kristian Løvstrøm <kristian@loevstroem.dk>
 */
class ChannelAwareLocaleProvider implements LocaleProviderInterface
{
    /**
     * Channel context.
     *
     * @var ChannelContextInterface
     */
    protected $channelContext;

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

    /**
     * {@inheritdoc}
     */
    public function getAvailableLocales()
    {
        $currentChannel =  $this->channelContext->getChannel();

        return $currentChannel->getLocales()->filter(function (LocaleInterface $locale) {
            return $locale->isEnabled();
        });
    }
}

<?php

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

namespace Sylius\Component\Core\Locale;

use Sylius\Component\Core\Channel\ChannelContextInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Bundle\LocaleBundle\Provider\LocaleProviderInterface;

/**
 * Locale provider, which returns locales enabled for this channel.
 *
 * @author Kristian Løvstrøm <kristian@loevstroem.dk>
 */
class ChannelAwareLocaleProvider implements LocaleProviderInterface
{
    /**
     * Channel context.
     *
     * @var ChannelContextInterface
     */
    protected $channelContext;

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

    /**
     * @param ChannelContextInterface $channelContext
     */
    public function __construct(ChannelContextInterface $channelContext, $defaultLocale)
    {
        $this->channelContext = $channelContext;
        $this->defaultLocale  = $defaultLocale;
    }

    /**
     * {@inheritdoc}
     */
    public function getAvailableLocales()
    {
        $currentChannel =  $this->channelContext->getChannel();

        return $currentChannel->getLocales()->filter(function (LocaleInterface $locale) {
            return $locale->isEnabled();
        });
    }

    /**
     * {@inheritdoc}
     */
    public function getLocales()
    {
        return array_map(function (LocaleInterface $locale) {
            return $locale->getCode();
        }, $this->getAvailableLocales());
    }

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

    /**
     * {@inheritdoc}
     */
    public function getRequiredLocales()
    {
        return array($this->defaultLocale);
    }
}

Fix bad merge & bugs

Fix bad merge & bugs