This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ phpunit --coverage-html=report | |
PHPUnit 4.1.4 by Sebastian Bergmann. | |
Configuration read from /path/to/phpunit.xml | |
................................................................. 65 / 85 ( 76%) | |
.................... | |
Time: 6.87 minutes, Memory: 116.25Mb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait GreetName | |
{ | |
/** | |
* @return array | |
*/ | |
public function interfacesForGreetName() | |
{ | |
return [HasGreeting::class, HasName::class]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_difference(array $first, array $second) { | |
return array_merge( | |
array_diff($first, $second), | |
array_diff($second, $first) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Console\Output\StreamOutput; | |
$handle = fopen("php://output", "w"); | |
$stream = new StreamOutput($handle); | |
Artisan::call("migrate", ["--path" => "Acme/Migration"], $stream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Action | |
{ | |
public function matches(array $message); | |
public function handle($inbox, array $message); | |
} | |
class TwitterAction implements Action | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scrutinizer: | |
inherit: true | |
tools: | |
external_code_coverage: true | |
checks: | |
php: | |
code_rating: true | |
duplication: true | |
filter: | |
paths: [src/*, tests/*] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
name=$(date +%s) | |
cd ../ | |
mkdir "temp_${name}" | |
cd "temp_${name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Process\Process; | |
$process = new Process('...'); | |
$process->run(function ($type, $buffer) { | |
if (Process::ERR === $type) { | |
echo 'ERR > '.$buffer; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bubble(data) { | |
var length = data.length; | |
while (length) { | |
for (var i = 1; i < length; i++) { | |
var prev = data[i - 1]; | |
var next = data[i]; | |
if (prev > next) { | |
data[i] = prev; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function merge(data) { | |
var length = data.length; | |
if (length === 1) { | |
return [data[0]]; | |
} | |
if (length === 2) { | |
if (data[0] > data[1]) { | |
return [data[1], data[0]]; |