Skip to content

Instantly share code, notes, and snippets.

@adrianstaffen
Last active July 2, 2021 12:04
Show Gist options
  • Save adrianstaffen/e1df25cd62c17d3f1a4697db6c449034 to your computer and use it in GitHub Desktop.
Save adrianstaffen/e1df25cd62c17d3f1a4697db6c449034 to your computer and use it in GitHub Desktop.
<?php
/**
* @license proprietary
*
* Modified by __root__ on 02-July-2021 using Strauss.
* @see https://github.com/BrianHenryIE/strauss
*/
namespace StraussTest\ST;
class StraussTestPackage {
public function __construct() {
// Simple call.
\StraussTest\ST\StraussTestPackage2::hello();
! \ST\StraussTestPackage2::hello();
// Variable assignment.
$test1 = \StraussTest\ST\StraussTestPackage2::hello();
$test2 = ! \ST\StraussTestPackage2::hello();
// If condition: Single.
if ( \StraussTest\ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
if ( ! \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
// If condition: Multiple (AND).
if ( \StraussTest\ST\StraussTestPackage2::hello() && ! \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
if ( ! \ST\StraussTestPackage2::hello() && \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
// If condition: Multiple (OR).
if ( \StraussTest\ST\StraussTestPackage2::hello() || ! \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
if ( ! \ST\StraussTestPackage2::hello() || \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
// Array: Non-associative: Single.
$arr1 = array(
\StraussTest\ST\StraussTestPackage2::hello(),
! \ST\StraussTestPackage2::hello(),
);
// Array: Non-associative: Multiple (AND).
$arr2 = array(
\StraussTest\ST\StraussTestPackage2::hello() && ! \ST\StraussTestPackage2::hello(),
! \ST\StraussTestPackage2::hello() && \ST\StraussTestPackage2::hello(),
);
// Array: Non-associative: Multiple (OR).
$arr3 = array(
\StraussTest\ST\StraussTestPackage2::hello() || ! \ST\StraussTestPackage2::hello(),
! \ST\StraussTestPackage2::hello() || \ST\StraussTestPackage2::hello(),
);
// Array: Associative: Single.
$assoc_arr1 = array(
'one' => \ST\StraussTestPackage2::hello(),
'two' => ! \ST\StraussTestPackage2::hello(),
);
// Array: Associative: Multiple (AND).
$assoc_arr1 = array(
'one' => \ST\StraussTestPackage2::hello() && ! \ST\StraussTestPackage2::hello(),
'two' => ! \ST\StraussTestPackage2::hello() && \ST\StraussTestPackage2::hello(),
);
// Array: Associative: Multiple (OR).
$assoc_arr1 = array(
'one' => \ST\StraussTestPackage2::hello() || ! \ST\StraussTestPackage2::hello(),
'two' => ! \ST\StraussTestPackage2::hello() || \ST\StraussTestPackage2::hello(),
);
}
}
<?php
namespace ST;
class StraussTestPackage {
public function __construct() {
// Simple call.
\ST\StraussTestPackage2::hello();
! \ST\StraussTestPackage2::hello();
// Variable assignment.
$test1 = \ST\StraussTestPackage2::hello();
$test2 = ! \ST\StraussTestPackage2::hello();
// If condition: Single.
if ( \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
if ( ! \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
// If condition: Multiple (AND).
if ( \ST\StraussTestPackage2::hello() && ! \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
if ( ! \ST\StraussTestPackage2::hello() && \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
// If condition: Multiple (OR).
if ( \ST\StraussTestPackage2::hello() || ! \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
if ( ! \ST\StraussTestPackage2::hello() || \ST\StraussTestPackage2::hello() ) {
echo 'hello world';
}
// Array: Non-associative: Single.
$arr1 = array(
\ST\StraussTestPackage2::hello(),
! \ST\StraussTestPackage2::hello(),
);
// Array: Non-associative: Multiple (AND).
$arr2 = array(
\ST\StraussTestPackage2::hello() && ! \ST\StraussTestPackage2::hello(),
! \ST\StraussTestPackage2::hello() && \ST\StraussTestPackage2::hello(),
);
// Array: Non-associative: Multiple (OR).
$arr3 = array(
\ST\StraussTestPackage2::hello() || ! \ST\StraussTestPackage2::hello(),
! \ST\StraussTestPackage2::hello() || \ST\StraussTestPackage2::hello(),
);
// Array: Associative: Single.
$assoc_arr1 = array(
'one' => \ST\StraussTestPackage2::hello(),
'two' => ! \ST\StraussTestPackage2::hello(),
);
// Array: Associative: Multiple (AND).
$assoc_arr1 = array(
'one' => \ST\StraussTestPackage2::hello() && ! \ST\StraussTestPackage2::hello(),
'two' => ! \ST\StraussTestPackage2::hello() && \ST\StraussTestPackage2::hello(),
);
// Array: Associative: Multiple (OR).
$assoc_arr1 = array(
'one' => \ST\StraussTestPackage2::hello() || ! \ST\StraussTestPackage2::hello(),
'two' => ! \ST\StraussTestPackage2::hello() || \ST\StraussTestPackage2::hello(),
);
}
}
<?php
namespace ST;
class StraussTestPackage2 {
public function __construct() {
return true;
}
public static function hello() {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment