Skip to content

Instantly share code, notes, and snippets.

View index.php
<?php
function run()
{
try {
if ('POST' === $_SERVER['REQUEST_METHOD']) {
echo template_action();
} else {
echo form_action();
}
View test.php
<?php
function should_return_array_or_nothing1() {
return false;
}
function should_return_array_or_nothing2() {
return null;
}
@MacDada
MacDada / 0_reuse_code.js
Created May 18, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:610c8576a44a4a0bfa42
MacBook-Pro-Dawid:symfony macdada$ php metrics.phar --report-html=build/halleck-metrics.html src
PHPMetrics by Jean-François Lépine <https://twitter.com/Halleck45>
1014/2789 [==========>-----------------] 36%file src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php is not valid and has been skipped
2788 files have been analyzed. Read and understand these 313351 lines of code will take around 01 hour(s), 04 minute(s) and 14 second(s).
Average for each module:
+--------------------------------------------------------------------------------------------------------------------+------------+---------------+----------------+-------+----------------+------------+--------+---------+------------+------+-------------+--------------+-------+-------+
View dnspec6.php
<?php
return
[
'It is initializable' => function ()
{
$this->shouldHaveType('StringCalculator');
},
'It requires string input' => function ()
View throwspec.php
<?php
// tak jest
$this->add('')->shouldReturn(0);
$this->shouldThrow('Exception')->during('add', [null]);
// a mogłoby być tak
$this->add('')->shouldReturn(0);
$this->add(null)->shouldThrow('Exception');
View dnspec2.php
<?php
namespace Dn;
class StringCalculatorSpec
{
public function specification($feature)
{
$feature('it_is_initializable', function ($it) {
$it->shouldHaveType('StringCalculator');
View dnspec.php
<?php
namespace Dn;
class StringCalculatorSpec
{
public function specification()
{
return [
'it_is_initializable' => function ($it) {
View dnspec6.php
<?php
return
[
'It is initializable' => function ($calculator)
{
$calculator->shouldHaveType('StringCalculator');
},
'It requires string input' => function ($calculator)
View phpspec.php
<?php
namespace spec;
use PhpSpec\ObjectBehavior;
class StringCalculatorSpec extends ObjectBehavior
{
function it_is_initializable()
{