<file_sep>class Inverter{
    
    initialBatteryCapacity = null;
    finalBatteryCapacity = null;
    initialBatteryPercentage = 0.7;
    finalBatteryPercentage = 0.9;

    getInitialBatteryCapacity(batteryAmp){
        this.initialBatteryCapacity = batteryAmp * this.initialBatteryPercentage;
        return this.initalBatteryCapacity;
    }

    getFinalBatteryCapacity(){
        this.finalBatteryCapacity = this.initialBatteryCapacity * this.finalBatteryPercentage;
        return this.finalBatteryCapacity; 
    }

}

n = new Inverter;
n.getInitialBatteryCapacity(200);
n.getFinalBatteryCapacity();
console.log(n);<file_sep><?php
namespace CsrfToken;

class CsrfToken
{

    public static function generateCsrfToken()
    {
        $_SESSION['token'] = base64_encode(openssl_random_pseudo_bytes(64));
    }

    public static function checkCsrfToken($csrfToken)
    {
        if (isset($_SESSION['token']) && $csrfToken === $_SESSION['token']) {
            unset($_SESSION['token']);
            return true;
        }
        return false;
    }
}
<file_sep><?php
$url            = 'http://sourcesms.com/api/api-function.php';
$fields_string  = null;

$fields = [
    'from' => 'MOSCO',
    'to' => '09036924798',
    'message' => 'hello world',
    'username' => '',
    'pword' => '',
    'hash' => '',
    'formcountry' => '234',
    'sourceinfo' => '1'
];

print_r($fields);
<file_sep><?php
require 'Interface.php';

class Model implements Test
{

    public function call()
    {
        echo "hello world\n";
    }

    public function foo()
    {
    }
}
<file_sep>if ($('.cookie-banner').length) {
    $('.cookie-banner').slideDown(5000);
}<file_sep><?php
if (isset($_GET['accept-cookies'])) {
    setcookie('accept-cookies', 'true', time() + 31556925);
    header('location: ./');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>cookie banner</title>
    <link rel="stylesheet" href="cookie.css">
</head>
<body>
<?php
if (!isset($_COOKIE['accept-cookies'])) {
    ?>
    <div class="cookie-banner">
        <div class="container">
            <p>we use cookies on this website. By using this website, we will assume you consent to 
                <a href="/cookies">the cookies we set</a> .</p>
            <a href="?accept-cookies" class="button">Ok, continue</a>
        </div>
    </div>
    <?php
}
?>
    <p>this is a cookie banner</p>

    <script src="jquery.js"></script>
    <script src="cookie.js"></script>
</body>
</html><file_sep>#include <iostream>
using namespace std;

double drainage_time;
int Qty,Battery_power,volt_out = 220;

double get_VA(int appliance_power){

double VA=appliance_power/0.8;
return VA;
}

double KVA(double VA) {

double KVA = VA/1000;
return KVA;
}

double get_DRAIN_CURR(double KVA){

double drain_current = (1000 * KVA) / volt_out;
return drain_current;
}

double get_battery_capacity(int Battery_power){

    double battery_capacity = Battery_power*0.7;
    return battery_capacity;
}

double get_real_battery_capacity( double battery_capacity){
    double real_battery_capacity = battery_capacity -(0.2*battery_capacity);
    return real_battery_capacity ;
}


int main(){

double appliance_power = 445;
Battery_power = 200;

double n = get_VA(appliance_power);
n = KVA(n);
n = get_DRAIN_CURR(n);

cout << n << endl ;

return 0;

}<file_sep><?php
require 'Model.php';

class Tester extends Model
{
    public function __construct()
    {
        $this->call();
    }
}

new Tester();
<file_sep><?php
namespace DB;

use PDO;
use PDOException;

class DB
{
    private static $instance = null;
    private $pdo;
    private $query;
    private $error = false;
    private $results;
    private $count = 0;
    private $lastInsertID = '';

    private function __construct()
    {
        try {
            $this->pdo = new PDO('mysql:host=127.0.0.1;dbname=test', 'root', '');
        } catch (PDOException $e) {
            die($e->getMessage());
        }
    }

    public static function getInstance()
    {
        if (!isset(self::$instance)) {
            self::$instance = new DB();
        }

        return self::$instance;
    }

    public function query($sql, $params = [])
    {
        $this->error = false;
        if ($this->query = $this->pdo->prepare($sql)) {
            $x = 1;
            if (count($params)) {
                foreach ($params as $param) {
                    $this->query->bindValue($x, $param);
                    $x++;
                }
            }
        }
        return $this;
    }
}
<file_sep><?php

interface Test
{
    function call();
}
<file_sep><?php
namespace Test;

class Test
{
    private $file = 'Connection.php';

    private $host = '$host';
    private $user = '$user';
    private $pass = <PASSWORD>';
    private $db = '$db';
    private $link = '$link';

    private $newhost = '$this->host';
    private $newuser = '$this->user';
    private $newpass = <PASSWORD>';
    private $newdb = '$this->db';
    private $newlink = '$this->link';

    private $connection = [];
    private $error = [];

    public function __construct()
    {
    }

    private function checkIfDatabaseConnectionFileExists()
    {
        if (file_exists($this->file)) {
            echo "it exists";
        } else {
            $this->createDatabaseConnectionFile();
        }
    }

    public function createDatabaseConnectionFile()
    {
        $fcontent = "<?php
namespace App\Core;

use mysqli;

class Connection
{
    private $this->host;
    private $this->user;
    private $this->pass;
    private $this->db;
    protected $this->link;

    public function __construct()
    {
        $this->newhost = 'localhost';
        $this->newuser = 'root';
        $this->newpass = '<PASSWORD>';
        $this->newdb = 'db';
    }

    protected function connect()
    {
        $this->newlink = new mysqli($this->newhost, $this->newuser, $this->newpass, $this->newdb);
        if (!$this->newlink) {
            echo 'connection to database is down';
        }
    }
}
        ";
        $file = fopen($this->file, 'w');
        fwrite($file, $fcontent);
        fclose($file);
    }
}

$f = new Test();
$f->createDatabaseConnectionFile();
<file_sep><?php
require 'vendor/autoload.php';

// This will output the barcode as HTML output to display in the browser
$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo "<div style='margin:0 auto; display:grid; grid-template-columns:20% 20% 20% 20% 20%;'>";
for ($i=0; $i < 50; $i++) {
    echo $generator->getBarcode(rand('0123456789', '9999999999'), $generator::TYPE_CODE_128).'<br>';
}
echo "</div>";
<file_sep><?php

require_once 'DB.php';

$db =  DB\DB::getInstance();
