This file contains hidden or 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 listarNomes(){ | |
return array('Raphael', 'Gabriela', 'Eduarda'); | |
} | |
$lista = listarNomes(); | |
echo $lista[0]; | |
//output: |
This file contains hidden or 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
<? | |
$arquivo = isset($_FILES["anexo"]) ? $_FILES["anexo"] : FALSE; | |
$arquivo_tratado = str_replace("+","-",$arquivo); | |
if(is_uploaded_file($arquivo_tratado['tmp_name'] && !empty ($erro)) | |
{ | |
$size = $_FILES[$arquivo_tratado]['size']; | |
if ($size > 10240000){ | |
$erro = "O tamanho maximo para envio de arquivo é de 10M. Por favor tente novamente."; |
This file contains hidden or 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 SomeClass { | |
public function add($x, $y) { return $x + $y; } | |
} | |
class TestComponent { | |
use SomeClass; | |
} |
This file contains hidden or 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
public function assertFlashMessenger($messenger) { | |
Zend_Controller_Action_HelperBroker::removeHelper('FlashMessenger'); | |
$mockFlashMessenger = \Mockery::mock('Zend_Controller_Action_Helper_FlashMessenger[getName, addMessage]') | |
->shouldReceive('addMessage')->with($messenger)->once() | |
->shouldReceive('getName')->andReturn('FlashMessenger') | |
->mock(); | |
Zend_Controller_Action_HelperBroker::addHelper($mockFlashMessenger); | |
} |
This file contains hidden or 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 | |
namespace Application\Service; | |
use Application\Entity\Realizacao; | |
class CumprirTarefa { | |
/** | |
* | |
* @var Tarefa | |
*/ |
This file contains hidden or 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
void setup() | |
{ | |
Serial.begin(9600); | |
pinMode(13, OUTPUT); | |
} | |
void loop() | |
{ | |
if (Serial.available() > 0) { | |
This file contains hidden or 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 | |
$port = fopen('/dev/ttyUSB0', 'w'); | |
fwrite($port, 'A'); | |
fwrite($port, 'a'); | |
fclose($port); |
This file contains hidden or 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 | |
/** | |
* Zend Framework | |
* | |
* LICENSE | |
* | |
* This source file is subject to the new BSD license that is bundled | |
* with this package in the file LICENSE.txt. | |
* It is also available through the world-wide-web at this URL: | |
* http://framework.zend.com/license/new-bsd |
This file contains hidden or 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
<? | |
$evento = array('data' => '05/11/2011', | |
'local' => 'Rio de Janeiro'); |
This file contains hidden or 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
<? | |
//Entidade que representa o modelo de negócio | |
$user = new User(); | |
//objeto que vai ser a interface do sistema (com usuários ou outros sistemas) | |
$formUser = new Form(); | |
//Desta forma desacoplaria as validações da interface | |
$formUser->setValidations($user->getValidations()); |