Skip to content

Instantly share code, notes, and snippets.

View alexander-zierhut's full-sized avatar
😃

Alexander Zierhut alexander-zierhut

😃
View GitHub Profile
@alexander-zierhut
alexander-zierhut / pcntl_fork_example.php
Created August 15, 2022 07:55
Example usage of pcntl_fork
<?php
class Task {
private $cb;
public function __construct(callable $cb) {
$this->cb = $cb;
}
public function start() {
@alexander-zierhut
alexander-zierhut / custom_inheritance.php
Created August 15, 2022 07:46
Example of custumized inheritance based on the magic method __call
<?php
class Factory {
protected $objectStorage = [];
public function assemble() {
foreach(func_get_args() as $className) {
$obj = new $className();
$this->objectStorage[] = [
"obj" => $obj,
"methods" => get_class_methods($obj)
@alexander-zierhut
alexander-zierhut / gitea_openproject_issue_migration.php
Last active February 1, 2022 23:47
Migrate Gitea Issues to Openproject
<?php
function getIssues() {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://git.YOUR_URL_HERE/api/v1/repos/YOUR_ORG/YOUR_REPO/issues?state=open&type=issues&limit=1000&access_token=YOUR_GITEA_ACCESS_TOKEN');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
return $result;