Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Remove duplicate method in the user model.
<?php namespace GovTribe\LaravelKinvey\Database\Eloquent; use Illuminate\Auth\UserInterface; use Illuminate\Auth\Reminders\RemindableInterface; class User extends Model implements UserInterface, RemindableInterface { /** * The collection associated with the model. * * @var string */ protected $collection =...
<?php namespace GovTribe\LaravelKinvey\Database\Eloquent; use Illuminate\Auth\UserInterface; use Illuminate\Auth\Reminders\RemindableInterface; class User extends Model implements UserInterface, RemindableInterface { /** * The collection associated with the model. * * @var string */ protected $collection =...
Change Tuple count view to use html table
<div class="container"> <?php echo '<h3>CollectionEvent Tuple Count: ' . $collecEvent . '</h3>'; ?> <?php echo '<h3>Locality Tuple Count: ' . $locality . '</h3>'; ?> <?php echo '<h3>PaleoContext Tuple Count: ' . $paleo . '</h3>'; ?> <?php echo '<h3>Specimen Tuple Count: ' . $specimen . '</h3>'; ?> <?php echo ...
<div class="container"> <table class="table table-hover table-striped table-condensed"> <tr> <th>Collection Event</th> <th>Locality</th> <th>Paleo Context</th> <th>Specimen</th> <th>Taxon Determination</th> <th>Total</th> </tr> <tr> <td><?php echo $collecEvent ?><...
Fix missing parent constructor call
<?php declare(strict_types=1); /** * @author Christoph Wurst <wurst.christoph@gmail.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * Mail * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General P...
<?php declare(strict_types=1); /** * @author Christoph Wurst <wurst.christoph@gmail.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * Mail * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General P...
Enable UUID validation on Assets
<?php namespace App\Http\Controllers; use Illuminate\Http\Response; abstract class AssetsController extends ApiController { // TODO: Had to be disabled due to a faulty import (id was citi_id). Please re-enable once that's fixed. // protected function validateId( $id ) // { // return $this->isUui...
<?php namespace App\Http\Controllers; use Illuminate\Http\Response; abstract class AssetsController extends ApiController { protected function validateId( $id ) { return $this->isUuid( $id ); } protected function respondInvalidSyntax($message = 'Invalid identifier', $detail = 'The id should...
Add the sitemap overlay route
<?php defined('C5_EXECUTE') or die("Access Denied."); /** * @var $router \Concrete\Core\Routing\Router */ $router->all('/arrange_blocks/', 'Page\ArrangeBlocks::arrange'); $router->all('/check_in/{cID}/{token}', 'Page::exitEditMode'); $router->all('/create/{ptID}', 'Page::create'); $router->all('/create/{ptID}/{paren...
<?php defined('C5_EXECUTE') or die("Access Denied."); /** * @var $router \Concrete\Core\Routing\Router */ $router->all('/arrange_blocks/', 'Page\ArrangeBlocks::arrange'); $router->all('/check_in/{cID}/{token}', 'Page::exitEditMode'); $router->all('/create/{ptID}', 'Page::create'); $router->all('/create/{ptID}/{paren...
Add option to provide hex string via command line
<?php require 'hex2base64.php'; $input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"; $target = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"; $output = hex2base64($input); echo "Input : $input\n"; echo "Target: $target\n"; echo "Output: $...
<?php require 'hex2base64.php'; if ($argc == 1) { $input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"; $target = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"; $output = hex2base64($input); echo "Input : $input\n"; echo "Target:...
Append existing query string to redirects
<?php namespace MOC\Redirects\Controller; use TYPO3\Flow\Annotations as Flow; use TYPO3\Neos\Service\LinkingService; use TYPO3\TYPO3CR\Domain\Model\Node; class RedirectController extends \TYPO3\Flow\Mvc\Controller\ActionController { /** * @Flow\Inject * @var LinkingService */ protected $linkingService; /**...
<?php namespace MOC\Redirects\Controller; use TYPO3\Flow\Annotations as Flow; use TYPO3\Neos\Service\LinkingService; use TYPO3\TYPO3CR\Domain\Model\Node; class RedirectController extends \TYPO3\Flow\Mvc\Controller\ActionController { /** * @Flow\Inject * @var LinkingService */ protected $linkingService; /**...
Implement test for read action
<?php namespace AppBundle\Tests\Controller; use AppBundle\Controller\BooksController; use AppBundle\Domain\Service\BookService; use AppBundle\MessageBus\CommandBus; class BooksControllerTest extends \PHPUnit_Framework_TestCase { public function testIndexActionRetrievesAllBooks() { $service = $this->g...
<?php namespace AppBundle\Tests\Controller; use AppBundle\Controller\BooksController; use AppBundle\Domain\Service\BookService; use AppBundle\Domain\Service\ObjectNotFoundException; use AppBundle\EventStore\Uuid; use AppBundle\MessageBus\CommandBus; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; c...
Return a more meaningful error message.
<?php namespace Craft; use CValidator; class CreditCard_NumberValidator extends CValidator { protected function validateAttribute($object, $attribute) { $number = $object->$attribute; if ($number && ! $this->validateLuhn($number)) { $message = Craft::t( '"{object}-...
<?php namespace Craft; use CValidator; class CreditCard_NumberValidator extends CValidator { protected function validateAttribute($object, $attribute) { $number = $object->$attribute; if ($number && ! $this->validateLuhn($number)) { $message = Craft::t('Invalid credit card number....
Add missing doc block info
<?php namespace MongoDB\Exception; class BadMethodCallException extends \BadMethodCallException implements Exception { /** * Thrown when accessing a result field on an unacknowledged write result. */ public static function unacknowledgedWriteResultAccess($method) { return new static(spri...
<?php namespace MongoDB\Exception; class BadMethodCallException extends \BadMethodCallException implements Exception { /** * Thrown when accessing a result field on an unacknowledged write result. * * @param string $method Method name * @return self */ public static function unacknowl...
Call getResults() instead of accessing the get() method manually for the IteratorAggregate and Countable functions
<?php namespace Elegant\Relations; use Countable; use ArrayIterator; use IteratorAggregate; use Elegant\Model; use Elegant\Result; use Elegant\Row; abstract class Relation implements Countable, IteratorAggregate { protected $parent; protected $related; protected $related_items = null; function __construct(Mode...
<?php namespace Elegant\Relations; use Countable; use ArrayIterator; use IteratorAggregate; use Elegant\Model; use Elegant\Result; use Elegant\Row; abstract class Relation implements Countable, IteratorAggregate { protected $parent; protected $related; function __construct(Model $parent, Model $related) { $th...
Update test function for testing mapping of full organism names
<?php namespace Tests\AppBundle\API\Mapping; use Symfony\Component\HttpFoundation\ParameterBag; use Tests\AppBundle\API\WebserviceTestCase; class FullByOrganismNameTest extends WebserviceTestCase { public function testExecute() { $service = $this->webservice->factory('mapping', 'fullByOrganismName');...
<?php namespace Tests\AppBundle\API\Mapping; use Symfony\Component\HttpFoundation\ParameterBag; use Tests\AppBundle\API\WebserviceTestCase; use AppBundle\API\Mapping; class FullByOrganismNameTest extends WebserviceTestCase { private $em; private $fullByOrganismName; public function setUp() { ...
Revert "set null soap parameters"
<?php /** * Created by PhpStorm. * User: Administrador * Date: 03/10/2017 * Time: 09:47 AM. */ namespace Greenter\Ws\Services; use Greenter\Ws\Header\WSSESecurityHeader; /** * Class SoapClient. */ class SoapClient implements WsClientInterface { private $client; /** * SoapClient constructor. ...
<?php /** * Created by PhpStorm. * User: Administrador * Date: 03/10/2017 * Time: 09:47 AM. */ namespace Greenter\Ws\Services; use Greenter\Ws\Header\WSSESecurityHeader; /** * Class SoapClient. */ class SoapClient implements WsClientInterface { private $client; /** * SoapClient constructor. ...
Fix for names with spaces
<?php namespace App\Http\Controllers; use App\Console\Commands\UpdatePvpLeaderboard; use Redis; class LeaderboardController extends Controller { /** * Get all leaderboard data * * @return $this */ public function pvpIndex() { $collection = Redis::get(UpdatePvpLeaderboard::$ke...
<?php namespace App\Http\Controllers; use App\Console\Commands\UpdatePvpLeaderboard; use Redis; class LeaderboardController extends Controller { /** * Get all leaderboard data * * @return $this */ public function pvpIndex() { $collection = Redis::get(UpdatePvpLeaderboard::$ke...
Return env instead of the $_server
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\Framewor...
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\Framewor...
Add getSRID() method to geometry
<?php /** * Copyright (C) 2016 Derek J. Lambert * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, me...
<?php /** * Copyright (C) 2016 Derek J. Lambert * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, me...
Update copy of unserialization error message
<?php /* * This file is part of CacheTool. * * (c) Samuel Gordalina <samuel.gordalina@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace CacheTool\Adapter; use CacheTool\Code; abstract class AbstractAdapter { ...
<?php /* * This file is part of CacheTool. * * (c) Samuel Gordalina <samuel.gordalina@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace CacheTool\Adapter; use CacheTool\Code; abstract class AbstractAdapter { ...
Use calendar-user-address-set for search rather than CS extension.
<?php /** * DAViCal CalDAV Server - handle principal-search-property-set report (RFC3744) * * @package davical * @subpackage caldav * @author Andrew McMillan <andrew@mcmillan.net.nz> * @copyright Morphoss Ltd - http://www.morphoss.com/ * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later */ /** * ...
<?php /** * DAViCal CalDAV Server - handle principal-search-property-set report (RFC3744) * * @package davical * @subpackage caldav * @author Andrew McMillan <andrew@mcmillan.net.nz> * @copyright Morphoss Ltd - http://www.morphoss.com/ * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later */ /** * ...
Add authorize constant to payment transitions
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Sylius\Component\Payment; final class PaymentTransitions { pu...
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Sylius\Component\Payment; final class PaymentTransitions { pu...
Allow the class attribute to pass through kses
<?php /** * @package _s */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> <?php if ( 'post' == get_post_type() ) : ?> <div class="e...
<?php /** * @package _s */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> <?php if ( 'post' == get_post_type() ) : ?> <div class="e...
Fix search results count() verification
@extends('app') @section('content') <div class="container"> @if ($results) {!! Alert::info(trans('app.search.msg.no_results', ['criteria' => $criteria])) !!} @else @foreach ($results as $category => $items) @include('manager.search._'.$category, ['items' => $items]) @endforeach @endif </div> @...
@extends('app') @section('content') <div class="container"> @if (count($results) == 0) {!! Alert::info(trans('app.search.msg.no_results', ['criteria' => $criteria])) !!} @else @foreach ($results as $category => $items) @include('manager.search._'.$category, ['items' => $items]) @endforeach @en...
Fix MySQL / PostgreSQL json column compatibility
<?php declare(strict_types=1); use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateTagsTable extends Migration { /** * Run the migrations. * * @return void */ public function up(): void { Sc...
<?php declare(strict_types=1); use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateTagsTable extends Migration { /** * Run the migrations. * * @return void */ public function up(): void { Sc...
Make sure Carbon creates UTC dates
<?php namespace Purplapp\Adn; use Carbon\Carbon; trait CarbonCreatedAtTrait { public function createdAt() { return Carbon::createFromFormat("Y-m-d\TH:i:s\Z", $this->created_at); } }
<?php namespace Purplapp\Adn; use Carbon\Carbon; trait CarbonCreatedAtTrait { public function createdAt() { return Carbon::createFromFormat("Y-m-d\TH:i:s\Z", $this->created_at, "UTC"); } }
Add more search path for composer autoload
<?php Configure::write('predictionIO', array( 'appkey' => 'your-key', 'userModel' => 'User', 'engine' => '' )); $files = array( APP . 'Vendor' . DS . 'autoload.php', App::pluginPath('PredictionIO') . 'vendor' . DS . 'autoload.php' ); foreach ($files as $file) { if (file_exists($file)) { ...
<?php Configure::write('predictionIO', array( 'appkey' => 'your-key', 'userModel' => 'User', 'engine' => '' )); $files = array( App::pluginPath('PredictionIO') . 'vendor' . DS . 'autoload.php', APP . 'Vendor' . DS . 'autoload.php', APP . 'vendor' . DS . 'autoload.php', ); foreach ($files ...
Document that a method key is also supported
<?php declare(strict_types = 1); namespace Rebing\GraphQL\Support\Contracts; use Rebing\GraphQL\Support\ExecutionMiddleware\AbstractExecutionMiddleware; interface ConfigConvertible { /** * @return array{ * execution_middleware?:array<class-string<AbstractExecutionMiddleware>>, * ...
<?php declare(strict_types = 1); namespace Rebing\GraphQL\Support\Contracts; use Rebing\GraphQL\Support\ExecutionMiddleware\AbstractExecutionMiddleware; interface ConfigConvertible { /** * @return array{ * execution_middleware?:array<class-string<AbstractExecutionMiddleware>>, * ...
Add docblock to correct return type provided by 2dotstwice collection
<?php namespace CultuurNet\UDB3\Media; use TwoDotsTwice\Collection\AbstractCollection; use TwoDotsTwice\Collection\CollectionInterface; use ValueObjects\Identity\UUID; class ImageCollection extends AbstractCollection implements CollectionInterface { /** * @var Image|null */ protected $mainImage; ...
<?php namespace CultuurNet\UDB3\Media; use ArrayIterator; use TwoDotsTwice\Collection\AbstractCollection; use TwoDotsTwice\Collection\CollectionInterface; use ValueObjects\Identity\UUID; class ImageCollection extends AbstractCollection implements CollectionInterface { /** * @var Image|null */ prote...
Allow folders with alpha-numerical name (no dash, no space)
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class StoreFolderRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Ge...
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class StoreFolderRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Ge...
Set text domain in class itself. Keeping it simple.
<?php /* Plugin Name: WP Relinquish Version: 0.0.1-alpha Description: With this plugin WordPress can <em>relinquish</em> content serving to an external system, for instance a Rails application with the <a href="https://github.com/hoppinger/wp-connector">wp-connector gem</a>. Author: Hoppinger Author URI: http://www.hop...
<?php /* Plugin Name: WP Relinquish Version: 0.0.1-alpha Description: With this plugin WordPress can <em>relinquish</em> content serving to an external system, for instance a Rails application with the <a href="https://github.com/hoppinger/wp-connector">wp-connector gem</a>. Author: Hoppinger Author URI: http://www.hop...
Tidy up resolveCallable() as $this is never an instance of ContainerInterface
<?php /** * Slim Framework (http://slimframework.com) * * @link https://github.com/codeguy/Slim * @copyright Copyright (c) 2011-2015 Josh Lockhart * @license https://github.com/codeguy/Slim/blob/master/LICENSE (MIT License) */ namespace Slim; use Interop\Container\ContainerInterface; /** * ResolveCallab...
<?php /** * Slim Framework (http://slimframework.com) * * @link https://github.com/codeguy/Slim * @copyright Copyright (c) 2011-2015 Josh Lockhart * @license https://github.com/codeguy/Slim/blob/master/LICENSE (MIT License) */ namespace Slim; use Interop\Container\ContainerInterface; /** * ResolveCallab...
Update loopback plugin to return valid Host header.
<?php /** * Plugin Name: E2E Enable Loopback * Description: Plugin to filter http requests to remove the port. * * @package Google\Site_Kit * @copyright 2020 Google LLC * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://sitekit.withgoogle.com */ add_filter( 'pre_...
<?php /** * Plugin Name: E2E Enable Loopback * Description: Plugin to filter http requests to remove the port. * * @package Google\Site_Kit * @copyright 2020 Google LLC * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://sitekit.withgoogle.com */ add_filter( 'pre_...
Remove Unix commands from build tool and replace with PHP native ones.
<?php $compileFile = 'SimplePie.compiled.php'; chdir(dirname(dirname(__FILE__))); `cat SimplePie.php > $compileFile.tmp`; `find SimplePie -type f| xargs cat | sed 's/^<?php//g'>>$compileFile.tmp`; $contents = file_get_contents("$compileFile.tmp"); $tokens = token_get_all($contents); $stripped_source = ''; foreach ($to...
<?php // Set up our constants define('SP_PATH', dirname(dirname(__FILE__))); define('COMPILED', SP_PATH . DIRECTORY_SEPARATOR . 'SimplePie.compiled.php'); function remove_header($contents) { $tokens = token_get_all($contents); $stripped_source = ''; $stripped_doc = false; $stripped_open = false; foreach ($tokens ...
Add validation for configuring story.
<?php use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\View; use Orchestra\Support\Facades\Asset; use Orchestra\Support\Facades\Widget; Event::listen('orchestra.ready: admin', 'Orchestra\Story\Services\Event\DashboardHandler@onDashboardView'); Event::listen('orchestra.form: extension.orchestra/sto...
<?php use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\View; use Orchestra\Support\Facades\Asset; use Orchestra\Support\Facades\Widget; Event::listen('orchestra.ready: admin', 'Orchestra\Story\Services\Event\DashboardHandler@onDashboardView'); Event::listen('orchestra.form: extension.orchestra/sto...
Implement some methods Constructor, mkdir, mkfile, path
<?php // Prevent this class from being included if another plugin // has already loaded it if (class_exists('GSUtils')) return; class GSUtils { // ... }
<?php // Prevent this class from being included if another plugin // has already loaded it if (class_exists('GSUtils')) return; class GSUtils { // == CONSTANTS == const EXCEPTION_MKDIR = 'mkDirErr'; const EXCEPTION_MKFILE = 'mkFileErr'; // == PROPERTIES == protected $options; protected $defaults = array(...
Change from refresh to redirect
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Go extends CI_Controller { /** * Method to redirect from an linq to a full URL */ public function index() { $this->log_redirect(); $linq = $this->uri->segment(1); //$this->db->select('url'); $query = $this->db-...
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Go extends CI_Controller { /** * Method to redirect from an linq to a full URL */ public function index() { $this->log_redirect(); $linq = $this->uri->segment(1); //$this->db->select('url'); $query = $this->db-...
Move users model into the correct namespace
<?php namespace Rogue; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that shou...
<?php namespace Rogue\Models; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes th...
Revert santizing toaddress, because PHPMailer now throws exceptions
<?php OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('files_sharing'); OCP\JSON::callCheck(); $user = OCP\USER::getUser(); // TODO translations $toaddress = OCP\Util::sanitizeHtml($_POST['toaddress']); $type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file'; $subject = $user.' shared a '.$type.' with...
<?php OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('files_sharing'); OCP\JSON::callCheck(); $user = OCP\USER::getUser(); // TODO translations $type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file'; $subject = $user.' shared a '.$type.' with you'; $link = $_POST['link']; $text = $user.' shared the ...
Add Acme\DemoBundle to main bundles, for testing
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\Sec...
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\Sec...
Add instruction about interpreter selection
<?php /** * Simple Breakpoints * * Tell the interpreter to pause execution and inspect variables. * * Ctrl+F8 (Windows/Linux) * Command+F8 (Mac OS X) */ namespace Debugging1\JetBrains; $name = 'Maarten'; // 1. Place a breakpoint on the following line of code. $name = 'Mikhail'; for ($i = 0; $i < 5; $i++) { ...
<?php /** * Simple Breakpoints * * Tell the interpreter to pause execution and inspect variables. * * Ctrl+F8 (Windows/Linux) * Command+F8 (Mac OS X) */ namespace Debugging1\JetBrains; $name = 'Maarten'; // 0. PhpStorm has already preconfigured "PHP 7.1 with XDebug" interpreter with enabled XDebug. Please make...
Fix returned value from ternary operation
<?php namespace Fulfillment\Postage\Api; use Fulfillment\Postage\Models\Request\Contracts\Postage as PostageContract; use Fulfillment\Postage\Exceptions\ValidationFailureException; use Fulfillment\Postage\Models\Request\Postage; class PostageApi extends ApiRequestBase { /** * @param PostageContract|array $p...
<?php namespace Fulfillment\Postage\Api; use Fulfillment\Postage\Models\Request\Contracts\Postage as PostageContract; use Fulfillment\Postage\Exceptions\ValidationFailureException; use Fulfillment\Postage\Models\Response\Postage as ResponsePostage; use Fulfillment\Postage\Models\Request\Postage as RequestPostage; cl...
Use OCP\JSON instead of OC_JSON
<?php OCP\JSON::callCheck(); OC_JSON::checkLoggedIn(); OCP\JSON::checkAdminUser(); $l=OC_L10N::get('core'); $groupname = $_POST["groupname"]; // Return Success story // TODO : make changes to the API to allow this. // setGroupname doesnt exist yet. if(OC_Group::setGroupname($groupname)) { OC_JSON::success( arra...
<?php OCP\JSON::callCheck(); OCP\JSON::checkLoggedIn(); OCP\JSON::checkAdminUser(); $l=OC_L10N::get('core'); $groupname = $_POST["groupname"]; // Return Success story // TODO : make changes to the API to allow this. // setGroupname doesnt exist yet. if(OC_Group::setGroupname($groupname)) { OCP\JSON::success( ar...
Add test for surnames with apostrophes
<?php require_once(dirname(__FILE__) . '/../classes/newuser.php'); class GenerateUsernameTest extends PHPUnit_Framework_TestCase { public function setUp() { $this -> user = new NewUser(); } public function testOneWordEach() { $this -> user -> setName('John', 'Smith'); ...
<?php require_once(dirname(__FILE__) . '/../classes/newuser.php'); class GenerateUsernameTest extends PHPUnit_Framework_TestCase { public function setUp() { $this -> user = new NewUser(); } public function testOneWordEach() { $this -> user -> setName('John', 'Smith'); ...
Put the content type here.
<?php # # $Id: news.php,v 1.1.2.18 2004-11-26 14:57:20 dan Exp $ # # Copyright (c) 1998-2003 DVL Software Limited # DEFINE('MAX_PORTS', 20); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/common.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/freshports.php'); require_once($_SERVER['DOCUMENT_R...
<?php # # $Id: news.php,v 1.1.2.19 2005-05-17 22:47:34 dan Exp $ # # Copyright (c) 1998-2003 DVL Software Limited # DEFINE('MAX_PORTS', 20); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/common.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/freshports.php'); require_once($_SERVER['DOCUMENT_R...
Use ZS9 library in default settings
<?php // default settings define('XMLSERVICELIB', 'ZENDSVR6'); //library with IBM XMLTOOLKIT objects define('DFTLIB', 'QGPL'); //library for creation of temporary objects define('ZSTOOLKITLIB', 'ZENDSVR6'); //library with service program define('ZSTOOLKITPGM', 'ZSXMLSRV'); //service progra...
<?php // default settings define('XMLSERVICELIB', 'ZENDPHP7'); //library with IBM XMLTOOLKIT objects define('DFTLIB', 'QGPL'); //library for creation of temporary objects define('ZSTOOLKITLIB', 'ZENDPHP7'); //library with service program define('ZSTOOLKITPGM', 'ZSXMLSRV'); //service progra...
Comment out the test entry until this section can be built correctly
<?php include('theme/header.php'); ?> <?php include('dbconnect.php'); $sql = "INSERT INTO small_victories (date, latest_amount) VALUES ('2017-01-25', '31945.78');"; if (mysqli_query($connection, $sql)) { echo "The new amount was added."; } else { echo "Oops! " . $sql . "<br>" . mysqli_error($connection); } mys...
<?php include('theme/header.php'); ?> <?php include('dbconnect.php'); //$sql = "INSERT INTO small_victories (date, latest_amount) VALUES ('2017-01-25', '31945.78');"; $sql = ''; if (mysqli_query($connection, $sql)) { echo "The new amount was added."; } else { echo "Oops! " . $sql . "<br>" . mysqli_error($connec...
Remove the array HTML escaping
<?php function html_escape_value($data) { if (!is_array($data)) { return htmlspecialchars($data, ENT_QUOTES, 'UTF-8', false); } $escapedData = array(); foreach ($data as $key => $value) { $escapedData[html_escape_value($key)] = html_escape_value($value); } return $escapedData...
<?php function html_escape_value($data) { return htmlspecialchars($data, ENT_QUOTES, 'UTF-8'); } /** * Dumps a value for consumption in tests * * The output format does not use any HTML special chars in boilerplate, to make * it simpler to write assertion on the HTML content generated based on it (no change ...
Document what structure the trusted facets list is based on
<?php /** * Copyright 2015 SURFnet bv * * 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 agr...
<?php /** * Copyright 2015 SURFnet bv * * 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 agr...
Fix XSS issue with redirects parameter
<?php //this plugin replaces %redirect% dynamic (so viewCache can be enabled) class Kwc_User_Login_Plugin extends Kwf_Component_Plugin_Abstract implements Kwf_Component_Plugin_Interface_ViewAfterChildRender { public function processOutput($output, $renderer) { if (strpos($output, '%redirect%') !== f...
<?php //this plugin replaces %redirect% dynamic (so viewCache can be enabled) class Kwc_User_Login_Plugin extends Kwf_Component_Plugin_Abstract implements Kwf_Component_Plugin_Interface_ViewAfterChildRender { public function processOutput($output, $renderer) { if (strpos($output, '%redirect%') !== f...
Change config from sample file to actually file.
<?php require_once __DIR__.'/vendor/autoload.php'; require_once __DIR__.'/config_sample.php'; require_once __DIR__.'/util/utils-loader.php'; require_once __DIR__.'/models/models-loader.php'; require_once __DIR__.'/controllers/controllers-loader.php'; $appConfig = [ 'settings' => [ 'displayErrorDetails' => true ]...
<?php require_once __DIR__.'/vendor/autoload.php'; require_once __DIR__.'/config.php'; require_once __DIR__.'/util/utils-loader.php'; require_once __DIR__.'/models/models-loader.php'; require_once __DIR__.'/controllers/controllers-loader.php'; $appConfig = [ 'settings' => [ 'displayErrorDetails' => true ], 'con...
Remove old caching logic, and add missing docblock.
<?php namespace VotingApp\Models; use Illuminate\Database\Eloquent\Model; use Cviebrock\EloquentSluggable\SluggableInterface; use Cviebrock\EloquentSluggable\SluggableTrait; class Category extends Model implements SluggableInterface { use SluggableTrait; public static function boot() { parent::b...
<?php namespace VotingApp\Models; use Illuminate\Database\Eloquent\Model; use Cviebrock\EloquentSluggable\SluggableInterface; use Cviebrock\EloquentSluggable\SluggableTrait; class Category extends Model implements SluggableInterface { use SluggableTrait; /** * The attributes which may be mass-assigned....
Add missing tests of SystemOfUnits
<?php namespace BinSoul\Test\Common\Measurement\SystemOfUnits; use BinSoul\Common\Measurement\SystemOfUnits; use BinSoul\Common\Measurement\Unit; use BinSoul\Common\Measurement\Converter; abstract class SystemOfUnitsTest extends \PHPUnit_Framework_TestCase { /** * @return SystemOfUnits */ abstract ...
<?php namespace BinSoul\Test\Common\Measurement\SystemOfUnits; use BinSoul\Common\Measurement\SystemOfUnits; use BinSoul\Common\Measurement\Unit; use BinSoul\Common\Measurement\Converter; abstract class SystemOfUnitsTest extends \PHPUnit_Framework_TestCase { /** * @return SystemOfUnits */ abstract ...
Fix url when using cdnUrl with S3. Null url was incorrectly used as path
<?php namespace FoF\Upload\Adapters; use FoF\Upload\Contracts\UploadAdapter; use FoF\Upload\File; use FoF\Upload\Helpers\Settings; use Illuminate\Support\Arr; class AwsS3 extends Flysystem implements UploadAdapter { protected function generateUrl(File $file) { /** @var Settings $settings */ $...
<?php namespace FoF\Upload\Adapters; use FoF\Upload\Contracts\UploadAdapter; use FoF\Upload\File; use FoF\Upload\Helpers\Settings; use Illuminate\Support\Arr; class AwsS3 extends Flysystem implements UploadAdapter { protected function generateUrl(File $file) { /** @var Settings $settings */ $...
Add functions to construct endpoint urls for REST API
<?php class phpBrowserStack extends BrowserStack { function __construct($username, $accessKey, $apiVersion = '3') { parent::__construct($username, $accessKey, $apiVersion); } public function test() { } } class BrowserStack { protected $username; protected $accessKey; prot...
<?php class phpBrowserStack extends BrowserStack { function __construct($username, $access_key, $api_version = '3') { parent::__construct($username, $access_key, $api_version); } public function test() { } } class BrowserStack { protected static $BASE_API_URL = 'http://api.browse...
FIX Capitalisation of trait usage
<?php namespace SilverStripe\VersionFeed\Filters; use SilverStripe\VersionFeed\VersionFeedController; use SilverStripe\Core\Config\Configurable; use Psr\SimpleCache\CacheInterface; use SilverStripe\Core\Injector\Injector; /** * Conditionally executes a given callback, attempting to return the desired results * o...
<?php namespace SilverStripe\VersionFeed\Filters; use SilverStripe\VersionFeed\VersionFeedController; use SilverStripe\Core\Config\Configurable; use Psr\SimpleCache\CacheInterface; use SilverStripe\Core\Injector\Injector; /** * Conditionally executes a given callback, attempting to return the desired results * o...
Fix hardwired redirect to analytics options page
<?php class Analytics_Options_Serializer { public function init() { add_action( 'admin_post_analytics_options', array( $this, 'save' ) ); } public static function save() { $option_name = 'analytics'; if ( empty( $_POST['id'] ) || empty( $_POST['vendor-type'] ) || empty( $_POST['config'] ) )...
<?php class Analytics_Options_Serializer { public function init() { add_action( 'admin_post_analytics_options', array( $this, 'save' ) ); } public static function save() { $option_name = 'analytics'; if ( empty( $_POST['id'] ) || empty( $_POST['vendor-type'] ) || empty( $_POST['config'] ) )...
Make access parameters a singleton.
<?php include_once("app/models/Utils.php"); class Dbc { protected static $instance = null; protected function __construct() { // Thou shalt not construct that which is unconstructable! } protected function __clone() { // Me not like clones! Me smash clones! } public static function getWriter() ...
<?php include_once("app/models/AccessParameters.php"); include_once("app/models/Utils.php"); class Dbc { protected static $instance = null; protected function __construct() { // Thou shalt not construct that which is unconstructable! } protected function __clone() { // Me not like clones! Me smash ...
Add cookie warning in compliance to eu cookie laws
<?php use Roots\Sage\Config; use Roots\Sage\Wrapper; ?> <?php get_template_part('templates/head'); ?> <body <?php body_class(); ?>> <!--[if lt IE 9]> <div class="alert alert-warning"> <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade yo...
<?php use Roots\Sage\Config; use Roots\Sage\Wrapper; ?> <?php get_template_part('templates/head'); ?> <body <?php body_class(); ?>> <!--[if lt IE 9]> <div class="alert alert-warning"> <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade yo...
Make the username field unique
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table...
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table...
Move app.min.js above closing body tag
</body> <script src="assets/js/app.min.js" charset="utf-8"></script> </html>
<script src="assets/js/app.min.js" charset="utf-8"></script> </body> </html>
Fix missing « c » char on LastFmApiException.php
<?php namespace LastFmApi\Exception; /** * CacheException * * @author Marcos Peña */ class ApiFailedException extends LastFmApiExeption { }
<?php namespace LastFmApi\Exception; /** * CacheException * * @author Marcos Peña */ class ApiFailedException extends LastFmApiException { }
Remove initial forward slash from url
<?php require 'src/EndpointRouter.php'; require 'src/endpoints/EndpointHandler.php'; require 'src/endpoints/SummaryEndpoint.php'; require 'src/endpoints/IPEndpoint.php'; require 'src/endpoints/RandomColorEndpoint.php'; require 'src/endpoints/TimeEndpoint.php'; header('Content-Type: application/json'); $router = new ...
<?php require 'src/EndpointRouter.php'; require 'src/endpoints/EndpointHandler.php'; require 'src/endpoints/SummaryEndpoint.php'; require 'src/endpoints/IPEndpoint.php'; require 'src/endpoints/RandomColorEndpoint.php'; require 'src/endpoints/TimeEndpoint.php'; header('Content-Type: application/json'); $router = new ...
Reduce noise in test output
<?php /** * @copyright Copyright (c) 2016, ownCloud GmbH. * * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Vincent Petry <pvince81@owncloud.com> * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public Licens...
<?php declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud GmbH. * * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Vincent Petry <pvince81@owncloud.com> * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Aff...
Add testCanJsonSerialize test to datetime helper
<?php namespace ZpgRtf\Tests\Helpers; use PHPUnit\Framework\TestCase; use ZpgRtf\Helpers\DateTimeHelper; class DateTimeHelperTest extends TestCase { public function testCanInstantiate() { $this->assertInstanceOf( DateTimeHelper::class, new DateTimeHelper() ); } ...
<?php namespace ZpgRtf\Tests\Helpers; use PHPUnit\Framework\TestCase; use ZpgRtf\Helpers\DateTimeHelper; class DateTimeHelperTest extends TestCase { public function testCanInstantiate() { $this->assertInstanceOf( DateTimeHelper::class, new DateTimeHelper() ); } ...
Add error page to test exceptions
<?php require __DIR__.'/../vendor/autoload.php'; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; $container = Yolo\Factory::createContainer(); $builder = $container->get('route_builder'); $builder->get('hello', '/', function (Request $request) { return new Response("...
<?php require __DIR__.'/../vendor/autoload.php'; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; $container = Yolo\Factory::createContainer(); $builder = $container->get('route_builder'); $builder->get('hello', '/', function (Request $request) { return new Response("...
Fix attempt to unset static property
<?php namespace Aedart\Scaffold\Cache; use Aedart\Scaffold\Containers\IoC; use Aedart\Scaffold\Contracts\Builders\IndexBuilder; use Illuminate\Contracts\Cache\Repository; /** * Cache Helper * * @author Alin Eugen Deac <aedart@gmail.com> * @package Aedart\Scaffold\Cache */ class CacheHelper { /** * Defau...
<?php namespace Aedart\Scaffold\Cache; use Aedart\Scaffold\Containers\IoC; use Aedart\Scaffold\Contracts\Builders\IndexBuilder; use Illuminate\Contracts\Cache\Repository; /** * Cache Helper * * @author Alin Eugen Deac <aedart@gmail.com> * @package Aedart\Scaffold\Cache */ class CacheHelper { /** * Defau...
Fix layout on save config page.
<?php $this->extend('setup/layout.html'); ?> <?php echo $Form->form(); ?> <p><?php echo tr('%1 could not save the configuration to the following file:', $app['name']); ?></p> <p><code><?php echo $file; ?></code></p> <?php if ($exists): ?> <p><?php echo tr('The file exists, but %1 does not have permission to write to ...
<?php echo $Form->form(); ?> <p><?php echo tr('%1 could not save the configuration to the following file:', $app['name']); ?></p> <p><code><?php echo $file; ?></code></p> <?php if ($exists): ?> <p><?php echo tr('The file exists, but %1 does not have permission to write to it.', $app['name']); ?></p> <p><?php echo tr('...
Fix controller call for static methods
<?php namespace MicroFW\Routing; use MicroFW\Http\Response; use MicroFW\Http\IResponse; use MicroFW\Core\Exceptions\NotValidResponseException; class Router { /** @var array */ private $routes; public function __construct($routes) { $this->routes = $routes; } /** * Return respons...
<?php namespace MicroFW\Routing; use MicroFW\Http\Response; use MicroFW\Http\IResponse; use MicroFW\Core\Exceptions\NotValidResponseException; class Router { /** @var array */ private $routes; public function __construct($routes) { $this->routes = $routes; } /** * Return respons...
Change messages and exceptions throws in dispatch method
<?php namespace PHPLegends\Routes; use PHPLegends\Routes\Exceptions\RouteException; class Dispatcher extends AbstractDispatcher { public function __construct($uri, $verbs) { $this->uri = $uri; $this->verbs = $verbs; } public function dispatch() { $routes = $this->getRouter()->getCollection()->filterByUri(...
<?php namespace PHPLegends\Routes; use PHPLegends\Routes\Exceptions\NotFoundException; use PHPLegends\Routes\Exceptions\InvalidVerbException; class Dispatcher extends AbstractDispatcher { public function __construct($uri, $verbs) { $this->uri = $uri; $this->verbs = $verbs; } public function dispatch() { $...
Fix the redirect via origin so we don't get a //
<? # $Id: logout.php,v 1.1.2.12 2003-07-04 14:59:16 dan Exp $ # # Copyright (c) 1998-2003 DVL Software Limited require_once($_SERVER['DOCUMENT_ROOT'] . '/include/common.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/freshports.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/databaselogin.php...
<? # $Id: logout.php,v 1.1.2.13 2003-09-25 10:46:14 dan Exp $ # # Copyright (c) 1998-2003 DVL Software Limited require_once($_SERVER['DOCUMENT_ROOT'] . '/include/common.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/freshports.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/include/databaselogin.php...
Remove from Spaces till implement toggle switch
<?php namespace humhub\modules\twitter; return [ 'id' => 'twitter', 'class' => 'humhub\modules\twitter\Module', 'namespace' => 'humhub\modules\twitter', 'events' => [ [ 'class' => \humhub\modules\dashboard\widgets\Sidebar::className(), 'event' => \humhub\modules\dashboa...
<?php namespace humhub\modules\twitter; return [ 'id' => 'twitter', 'class' => 'humhub\modules\twitter\Module', 'namespace' => 'humhub\modules\twitter', 'events' => [ [ 'class' => \humhub\modules\dashboard\widgets\Sidebar::className(), 'event' => \humhub\modules\dashboa...
Remove unused php open and close tags
<?php error_reporting(E_ALL & ~E_NOTICE); foreach (glob("functions/*.php") as $filename) { include $filename; } if ( isset($_GET['host']) && !empty($_GET['host'])) { $data = []; $hostname = mb_strtolower(get($_GET['host'])); $host = parse_hostname($hostname); if ($host['port']) { $port = $host['port']; ...
<?php error_reporting(E_ALL & ~E_NOTICE); foreach (glob("functions/*.php") as $filename) { include $filename; } if ( isset($_GET['host']) && !empty($_GET['host'])) { $data = []; $hostname = mb_strtolower(get($_GET['host'])); $host = parse_hostname($hostname); if ($host['port']) { $port = $host['port']; ...
Add @covers annotation to test how coverage report changes.
<?php use PreSQL\PDO; class PDOTest extends PHPUnit_Framework_TestCase { public function testIsPreSQLPDOVersionReturnedCorrectly() { $this->assertEquals(PDO::getVersion(), PDO::$version); } }
<?php use PreSQL\PDO; class PDOTest extends PHPUnit_Framework_TestCase { /** * @covers \PreSQL\PDO */ public function testIsPreSQLPDOVersionReturnedCorrectly() { $this->assertEquals(PDO::getVersion(), PDO::$version); } }
Split preparating of context into separate method when rendering pages
<?php declare(strict_types=1); namespace MattyG\BBStatic\Content\Page; use MattyG\BBStatic\BBCode\NeedsBBCodeRendererTrait; use MattyG\BBStatic\Util\Vendor\NeedsTemplateEngineTrait; use Symfony\Component\Filesystem\NeedsFilesystemTrait; final class PageRenderer { use NeedsBBCodeRendererTrait; use NeedsFilesy...
<?php declare(strict_types=1); namespace MattyG\BBStatic\Content\Page; use MattyG\BBStatic\BBCode\NeedsBBCodeRendererTrait; use MattyG\BBStatic\Util\Vendor\NeedsTemplateEngineTrait; use Symfony\Component\Filesystem\NeedsFilesystemTrait; class PageRenderer { use NeedsBBCodeRendererTrait; use NeedsFilesystemTr...
Add File uploaded check or create API.
<?php namespace Zhiyi\Plus\Http\Controllers\APIs\V2; use Illuminate\Http\Request; use Zhiyi\Plus\Models\File as FileModel; use Zhiyi\Plus\Http\Controllers\Controller; use Zhiyi\Plus\Models\FileWith as FileWithModel; use Illuminate\Contracts\Routing\ResponseFactory as ResponseContract; class FilesController extends C...
<?php namespace Zhiyi\Plus\Http\Controllers\APIs\V2; use Illuminate\Http\Request; use Zhiyi\Plus\Models\File as FileModel; use Zhiyi\Plus\Http\Controllers\Controller; use Zhiyi\Plus\Models\FileWith as FileWithModel; use Illuminate\Contracts\Routing\ResponseFactory as ResponseContract; class FilesController extends C...
Complete cyclic rotation on a given array.
<?php class CyclicRotation { private $array; private $rotation; public function __construct($array, $rotation) { $this->array = $array; $this->rotation = $rotation; } /** * @param mixed $rotation */ public function setRotation($rotation) { $this->rotation = $r...
<?php class CyclicRotation { private $array; private $rotation; public function __construct($array, $rotation) { $this->array = $array; $this->rotation = $rotation; } /** * @param mixed $rotation */ public function setRotation($rotation) { $this->rotation = $r...
Create Season Admin roles for each season seeded
<?php use App\Models\Season; use Illuminate\Database\Seeder; class SeasonsTableSeeder extends Seeder { public function run(): void { factory(Season::class)->times(2)->create(); } }
<?php use App\Models\Season; use Illuminate\Database\Seeder; use Spatie\Permission\Models\Role; class SeasonsTableSeeder extends Seeder { public function run(): void { factory(Season::class)->times(2)->create(); $this->createRoles(); } private function createRoles(): void { ...
Check getRootNode method exists for older Symfony versions
<?php namespace AshleyDawson\SimplePaginationBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; /** * Class Configuration * * @package AshleyDawson\SimplePaginationBundle\DependencyInjection * @author Ashley Daw...
<?php namespace AshleyDawson\SimplePaginationBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; /** * Class Configuration * * @package AshleyDawson\SimplePaginationBundle\DependencyInjection * @author Ashley Daw...
Add simple seeder for Ads
<?php class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); $this->call('CategoriesTableSeeder'); $this->command->info('Categories table seeded!'); } } class CategoriesTableSeeder extends Seeder { public fu...
<?php class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); $this->call('CategoriesTableSeeder'); $this->command->info('Categories table seeded!'); $this->call('AdsTableSeeder'); $this->command->i...
Revert "Popular expression: "A ver se pinta"."
<?php include_once('../../config/init.php'); include_once($BASE_DIR . 'database/models.php'); function getComments($comments) { global $smarty; $smarty->assign("comments", $comments); $smarty->display('models/comments.tpl'); } class CommentsHandler { function post($modelId) { // TODO: xhr glo...
<?php include_once($BASE_DIR . 'database/models.php'); function getComments($comments) { global $smarty; $smarty->assign("comments", $comments); $smarty->display('models/comments.tpl'); } class CommentsHandler { function post($modelId) { // TODO: xhr global $BASE_DIR; global $smarty; ...
Fix Config loading in DownloadCsv
<?php namespace NemC\IP2LocLite\Commands; use Illuminate\Console\Config, Illuminate\Console\Command, NemC\IP2LocLite\Services\IP2LocLiteService, NemC\IP2LocLite\Exceptions\NotLoggedInResponseException, NemC\IP2LocLite\Exceptions\UnsupportedDatabaseCommandException; class DownloadCsvCommand extends Co...
<?php namespace NemC\IP2LocLite\Commands; use Illuminate\Support\Facades\Config, Illuminate\Console\Command, NemC\IP2LocLite\Services\IP2LocLiteService, NemC\IP2LocLite\Exceptions\NotLoggedInResponseException, NemC\IP2LocLite\Exceptions\UnsupportedDatabaseCommandException; class DownloadCsvCommand ex...
Fix composer for inplace in dev mode
<?php require_once __DIR__ . '/deployer/recipe/yii2-app-advanced.php'; require_once __DIR__ . '/deployer/recipe/yii-configure.php'; require_once __DIR__ . '/deployer/recipe/in-place.php'; if (!file_exists (__DIR__ . '/deployer/stage/servers.yml')) { die('Please create "' . __DIR__ . '/deployer/stage/servers.yml" bef...
<?php require_once __DIR__ . '/deployer/recipe/yii2-app-advanced.php'; require_once __DIR__ . '/deployer/recipe/yii-configure.php'; require_once __DIR__ . '/deployer/recipe/in-place.php'; if (!file_exists (__DIR__ . '/deployer/stage/servers.yml')) { die('Please create "' . __DIR__ . '/deployer/stage/servers.yml" bef...
Resolve an unassigned variable error.
<?php if(!Utility::isBot()) { if(!$sidebar) { $sidebar = false; } if($article) { $advert = \FelixOnline\Core\Advert::randomPick('articles', $sidebar, $article->getCategory()); } elseif($category) { $advert = \FelixOnline\Core\Advert::randomPick('categories', $sidebar, $category); } else { $adver...
<?php if(!Utility::isBot()) { if(!isset($sidebar)) { $sidebar = false; } if($article) { $advert = \FelixOnline\Core\Advert::randomPick('articles', $sidebar, $article->getCategory()); } elseif($category) { $advert = \FelixOnline\Core\Advert::randomPick('categories', $sidebar, $category); } else { ...
Fix ProductPrice dependency on ApiBundle - changed class name to string
<?php namespace Oro\Bundle\ApiBundle\Tests\Functional\Environment\Entity; use Oro\Bundle\PricingBundle\Entity\ProductPrice; class SkippedEntitiesProvider { /** * @return array */ public static function getForUpdateAction(): array { return [ ProductPrice::class, ]; ...
<?php namespace Oro\Bundle\ApiBundle\Tests\Functional\Environment\Entity; class SkippedEntitiesProvider { /** * @return array */ public static function getForUpdateAction(): array { return [ 'Oro\Bundle\PricingBundle\Entity\ProductPrice', ]; } /** * @ret...
Check that the session authentication isset before loading the page
<?php session_start(); if(!isset($_SESSION['user']) && !isset($_SESSION['userId'])) { die(header('Location: login.php')); } ?> <!DOCTYPE html> <html> <head> <title> Note Keeper </title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrom...
<?php session_start(); if(!isset($_SESSION['user']) && !isset($_SESSION['userId']) || !isset($_SESSION['authentication'])) { die(header('Location: login.php')); } ?> <!DOCTYPE html> <html> <head> <title> Note Keeper </title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="...
Add missing newline at end of file
<?php namespace Eris; class SampleTest extends \PHPUnit_Framework_TestCase { use TestTrait; public function testWithGeneratorSize() { $times = 100; $generatorSize = 100; $generator = Generator\suchThat(function ($n) { return $n > 10; }, Generato...
<?php namespace Eris; class SampleTest extends \PHPUnit_Framework_TestCase { use TestTrait; public function testWithGeneratorSize() { $times = 100; $generatorSize = 100; $generator = Generator\suchThat(function ($n) { return $n > 10; }, Generato...
Update User with its namespace
<?php class UserTableSeeder extends Seeder { public function run() { DB::table('users')->delete(); User::create(array( 'email' => 'chawkinsuf@gmail.com', 'password' => '123456', 'nest_password' => '51gBJAh*yOEN*SK' )); } }
<?php class UserTableSeeder extends Seeder { public function run() { DB::table('users')->delete(); App\Models\User::create(array( 'email' => 'chawkinsuf@gmail.com', 'password' => '123456', 'nest_password' => '51gBJAh*yOEN*SK' )); } }
Change accoring to PR comments. moving code inside if block
<?php namespace Omise\Payment\Block\Checkout\Onepage\Success; class PaynowAdditionalInformation extends \Magento\Framework\View\Element\Template { /** * @var \Magento\Checkout\Model\Session */ protected $_checkoutSession; /** * @param \Magento\Framework\View\Element\Template\Context $contex...
<?php namespace Omise\Payment\Block\Checkout\Onepage\Success; class PaynowAdditionalInformation extends \Magento\Framework\View\Element\Template { /** * @var \Magento\Checkout\Model\Session */ protected $_checkoutSession; /** * @param \Magento\Framework\View\Element\Template\Context $contex...
Fix wrong classname in deprecation message
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Cache\Simple; use Symfony\Component\Cache\Traits\Apcu...
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Cache\Simple; use Symfony\Component\Cache\Adapter\Apc...
Add capbility to render value as return on standard js render signature. Fix cs and doc blocks.
<?php namespace Yajra\Datatables\Html; use Illuminate\Support\Fluent; /** * Class Column * * @package Yajra\Datatables\Html * @see https://datatables.net/reference/option/ for possible columns option */ class Column extends Fluent { /** * @param array $attributes */ public function __const...
<?php namespace Yajra\Datatables\Html; use Illuminate\Support\Fluent; /** * Class Column * * @package Yajra\Datatables\Html * @see https://datatables.net/reference/option/ for possible columns option */ class Column extends Fluent { /** * @param array $attributes */ public function __const...
Add classification to base instance object
<?php /** * Class definition for DTS_Instance. * * @package DTS * @author Eric Bollens * @copyright Copyright (c) 2012 UC Regents * @license BSD * @version 20120131 */ /** * A class that encapsulates the instance of DTS in js.php and passthru.php. * * @package DTS * @see /...
<?php /** * Class definition for DTS_Instance. * * @package DTS * @author Eric Bollens * @copyright Copyright (c) 2012 UC Regents * @license BSD * @version 20120131 */ /** * A class that encapsulates the instance of DTS in js.php and passthru.php. * * @package DTS * @see /...
Fix empty ID and EMAIL attributes of org:people:list result
<?php namespace Pantheon\Terminus\Friends; use Pantheon\Terminus\Models\User; /** * Class UserJoinTrait * @package Pantheon\Terminus\Friends */ trait UserJoinTrait { /** * @var User */ private $user; /** * @inheritdoc */ public function getReferences() { return arr...
<?php namespace Pantheon\Terminus\Friends; use Pantheon\Terminus\Models\User; /** * Class UserJoinTrait * @package Pantheon\Terminus\Friends */ trait UserJoinTrait { /** * @var User */ private $user; /** * @inheritdoc */ public function getReferences() { return arr...
Update column if it exists, create new column if not
<?php use Migrations\AbstractMigration; class ReorganizeTranslationTable extends AbstractMigration { /** * Change Method. * * More information on this method is available here: * http://docs.phinx.org/en/latest/migrations.html#the-change-method * @return void */ public function ch...
<?php use Migrations\AbstractMigration; class ReorganizeTranslationTable extends AbstractMigration { /** * Change Method. * * More information on this method is available here: * http://docs.phinx.org/en/latest/migrations.html#the-change-method * @return void */ public function ch...
Add keypair services to provider
<?php namespace Chromabits\Illuminated\Auth; use Chromabits\Illuminated\Auth\Models\KeyPair; use Chromabits\Illuminated\Support\ServiceProvider; /** * Class KeyPairServiceProvider * * @author Eduardo Trujillo <ed@chromabits.com> * @package Chromabits\Illuminated\Auth */ class KeyPairServiceProvider extends Serv...
<?php namespace Chromabits\Illuminated\Auth; use Chromabits\Illuminated\Auth\Interfaces\KeyPairFinderInterface; use Chromabits\Illuminated\Auth\Interfaces\KeyPairGeneratorInterface; use Chromabits\Illuminated\Auth\Models\KeyPair; use Chromabits\Illuminated\Support\ServiceMapProvider; /** * Class KeyPairServiceProvi...
Add DB_CONNECTOR constant & comments
<?php define('DB_HOST', 'db-server'); define('DB_NAME', 'db-name'); define('DB_USER', 'db-user'); define('DB_PASSWORD', 'db-password'); define( 'APP_PATH', realpath('..') . '/app' ); //AuthSession params //define('AUTH_USER_MODEL', 'YOUR MODEL CLASS'); //define('AUTH_CRYPTO_COST', 10);
<?php define('DB_CONNECTOR', 'mysql'); // Possible values: mysq, sqlite define('DB_HOST', 'db-server'); define('DB_NAME', 'db-name'); // sqlite: used as file path define('DB_USER', 'db-user'); define('DB_PASSWORD', 'db-password'); define( 'APP_PATH', realpath('..') . '/app' ); //AuthSession params //define('AUTH_USER...
Move configuration to Bundle Extension.
<?php namespace Clastic\TaxonomyBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader; /** * This is the class that loads and m...
<?php namespace Clastic\TaxonomyBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\C...
Move test logic into a function for re-use.
<?php $repo_clone_url = '{ user: "%1$s", team: "%2$s", project: "%3$s" }'; $user = 'bees'; $team = 'ABC'; $project = 'wasps'; $expected_url = "{ user: \"$user\", team: \"$team\", project: \"$project\" }"; $config = Configuration::getInstance(); $config->override('repo_clone_url', $repo_clone_url); $config->override('...
<?php $repo_clone_url = '{ user: "%1$s", team: "%2$s", project: "%3$s" }'; $user = 'bees'; $team = 'ABC'; $project = 'wasps'; $config = Configuration::getInstance(); $config->override('repo_clone_url', $repo_clone_url); $config->override('modules', array('proj')); $config->override("user.default", "death"); $config-...
Use phpcs as a library.
#!/usr/bin/env php <?php chdir(__DIR__); $returnStatus = null; passthru('composer install --dev', $returnStatus); if ($returnStatus !== 0) { exit(1); } require 'vendor/autoload.php'; passthru('./vendor/bin/phpcs --standard=PSR1 -n src tests *.php', $returnStatus); if ($returnStatus !== 0) { exit(1); } $phpu...
#!/usr/bin/env php <?php chdir(__DIR__); $returnStatus = null; passthru('composer install --dev', $returnStatus); if ($returnStatus !== 0) { exit(1); } require 'vendor/autoload.php'; $phpcsCLI = new PHP_CodeSniffer_CLI(); $phpcsArguments = array('standard' => array('PSR1'), 'files' => array('src', 'tests', 'buil...
Fix extra output in tests
<?php namespace Rocketeer\Abstracts\Strategies; use Mockery\MockInterface; use Rocketeer\TestCases\RocketeerTestCase; class AbstractStrategyTest extends RocketeerTestCase { public function testCanCheckForManifestWithoutServer() { $this->app['path.base'] = realpath(__DIR__.'/../../..'); $this->...
<?php namespace Rocketeer\Abstracts\Strategies; use Mockery\MockInterface; use Rocketeer\TestCases\RocketeerTestCase; class AbstractStrategyTest extends RocketeerTestCase { public function testCanCheckForManifestWithoutServer() { $this->app['path.base'] = realpath(__DIR__.'/../../..'); $this->...
Fix PHP OOM error while processing test coverage
<?php use Desk\Test\Helper\TestCase; use Guzzle\Service\Builder\ServiceBuilder; error_reporting(-1); $ds = DIRECTORY_SEPARATOR; $autoloader = dirname(__DIR__) . "{$ds}vendor{$ds}autoload.php"; // Ensure that Composer dependencies have been installed locally if (!file_exists($autoloader)) { die( "Depend...
<?php use Desk\Test\Helper\TestCase; use Guzzle\Service\Builder\ServiceBuilder; ini_set('memory_limit', '256M'); error_reporting(-1); $ds = DIRECTORY_SEPARATOR; $autoloader = dirname(__DIR__) . "{$ds}vendor{$ds}autoload.php"; // Ensure that Composer dependencies have been installed locally if (!file_exists($autolo...
Move Namespace in first line
<?php namespace Xaamin\Curl; use Illuminate\Foundation\AliasLoader as Loader; use Illuminate\Support\ServiceProvider; /** * CURL Service provider * * @package Xaamin\Curl * @author Benjamín Martínez Mateos <bmxamin@gmail.com> */ class CurlServiceProvider extends ServiceProvider { /** * Indicates if lo...
<?php namespace Xaamin\Curl; use Illuminate\Foundation\AliasLoader as Loader; use Illuminate\Support\ServiceProvider; /** * CURL Service provider * * @package Xaamin\Curl * @author Benjamín Martínez Mateos <bmxamin@gmail.com> */ class CurlServiceProvider extends ServiceProvider { /** * Indicates if loa...
Change the year to 2017
<!-- Main Footer --> <footer class="main-footer"> <!-- To the right --> <div class="pull-right hidden-xs"> <strong class="text-red">IPC Portal</strong> </div> <!-- Default to the left --> <!-- <strong>System By Management Information System Section</strong> --> <strong>&copy; 2016 <a href="http://www.isuzuphil...
<!-- Main Footer --> <footer class="main-footer"> <!-- To the right --> <div class="pull-right hidden-xs"> <strong class="text-red">IPC Portal</strong> </div> <!-- Default to the left --> <!-- <strong>System By Management Information System Section</strong> --> <strong>&copy; 2017 <a href="http://www.isuzuphil...