PHP code example of pattisahusiwa / coding-standard
1. Go to this page and download the library: Download pattisahusiwa/coding-standard library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pattisahusiwa / coding-standard example snippets
declare(strict_types=1);
namespace Ptscs\Tests;
use ParentClass;
use SomeInterface;
final class Classes extends ParentClass implements SomeInterface
{
use sometrait;
/**
* @var object
*/
private $obj1;
/**
* @var object
*/
private $obj2;
/**
* @var string[]
*/
private $data = [];
// Example of multiline function arguments
public function __construct(
object $obj1,
object $obj2
) {
$this->obj1 = $obj1;
$this->obj2 = $obj2;
}
public function setData(string $key, string $value): void
{
$this->data[$key] = $value;
}
public function getData(string $key): string
{
if (array_key_exists($key, $this->data) === true) {
return $this->data[$key];
}
return '';
}
}