blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
116
path
stringlengths
2
241
src_encoding
stringclasses
31 values
length_bytes
int64
14
3.6M
score
float64
2.52
5.13
int_score
int64
3
5
detected_licenses
listlengths
0
41
license_type
stringclasses
2 values
text
stringlengths
14
3.57M
download_success
bool
1 class
81b030534b897d08fd452d1306bc0c4541345088
PHP
SobhieSaad/warehouse
/app/Http/Controllers/AuthController.php
UTF-8
2,244
2.625
3
[ "MIT" ]
permissive
<?php namespace App\Http\Controllers; use Illuminate\Contracts\Validation\Validator; use Illuminate\Http\Request; use App\Models\User; use Illuminate\Http\Response; use Illuminate\Support\Facades\Hash; class AuthController extends Controller { public function register(Request $request){ $fields=$request->validate([ 'first_name'=>'required|string', 'last_name'=>'required|string', 'phone'=>'required|string', 'email'=>'required|string', 'password'=>'required|string|confirmed' ]); $user=User::create([ 'first_name'=>$fields['first_name'], 'last_name'=>$fields['last_name'], 'phone'=>$fields['phone'], 'email'=>$fields['email'], 'password'=>bcrypt( $fields['password']), ]); $token=$user->createToken($fields['first_name'])->plainTextToken; $response=[ 'user'=>$user, 'token'=> $token ]; return response($response,201); } public function login (Request $request) { $validator = Validator::make($request->all(), [ 'email' => 'required|string|email|max:255', 'password' => 'required|string|min:6|confirmed', ]); if ($validator->fails()) { return response(['errors'=>$validator->errors()->all()], 422); } $user = User::where('email', $request->email)->first(); if ($user) { if (Hash::check($request->password, $user->password)) { $token = $user->createToken('Laravel Password Grant Client')->accessToken; $response = ['token' => $token]; return response($response, 200); } else { $response = ["message" => "Password mismatch"]; return response($response, 422); } } else { $response = ["message" =>'User does not exist']; return response($response, 422); } } public function logout (Request $request) { $token = $request->user()->token(); $token->revoke(); $response = ['message' => 'You have been successfully logged out!']; return response($response, 200); } }
true
689d2d07c59c1dab3e0e51e9c8da841b65163b23
PHP
leagueofbeards/Stripe-for-Habari
/classes/products.php
UTF-8
685
2.578125
3
[ "Apache-2.0" ]
permissive
<?php namespace Habari; /** * Products Class * */ class Products extends Posts { public static function get($paramarray = array()) { $defaults = array( 'content_type' => 'product', 'fetch_class' => 'Product', ); $paramarray = array_merge($defaults, Utils::get_params($paramarray)); return Posts::get( $paramarray ); } public static function find_my_products($person) { $ids = array(); $p_ids = DB::get_results( "SELECT product_id FROM {transactions} WHERE user_id = " . $person->id ); foreach( $p_ids as $id ) { $ids[] = $id->product_id; } return self::get( array('id' => $ids, 'nolimit' => true) ); } } ?>
true
8d2888b3321d070320142670a6b7fcb18e9ca8aa
PHP
GiuseppeDiM/Prog-IS_Immobilunisa
/Implementazione/subsystem/facadeTrattative.php
UTF-8
2,354
2.84375
3
[]
no_license
<?php include_once("database.php"); include_once("trattativa.php"); include_once("interfacciaGestioneTrattative.php"); class facadeGestioneTrattative implements gestioneTrattative{ function facadeGestioneTrattative(){ } function approvaTrattativa($id){ $trattativa=new Trattativa(); $trattativa->select($id); if($trattativa->getApprovata()!=null){ $trattativa->setApprovata(true); $trattativa->update($id); } else return null; return $trattativa; } function assegnaTrattativa($id,$agente){ $trattativa=new Trattativa(); $trattativa->select($id); //if($trattativa->getAgente()==null){ $trattativa->setAgente($agente); $trattativa->update($id); return $trattativa; //} //return null; } function creaTrattativa( $acquirente, $agente, $immobile, $approvata){ $trattativa=new Trattativa(); $dt = new DateTime(); $data= $dt->format('Y-m-d'); $trattativa->setId(null); $trattativa->setAcquirente($acquirente); $trattativa->setAgente($agente); $trattativa->setImmobile($immobile); $trattativa->setData($data); $trattativa->setApprovata($approvata); $trattativa->insert(); } function eliminaTrattativa($id){ $trattativa=new Trattativa(); $database=new Database(); $query="SELECT * FROM trattativa WHERE id='$id'"; $database->query($query); $res=$database->result; $riga=mysql_fetch_array($res); if($riga[0]!=null) { $trattativa->delete($id); return 1; } return 0; } function visualizzaTrattativa($id){ $trattativa=new Trattativa(); $database=new Database(); $query="SELECT * FROM trattativa WHERE id='$id'"; $database->query($query); $res=$database->result; $riga=mysql_fetch_array($res); if($riga[0]!=null) { $trattativa->select($id); return $trattativa; } return null; } function getTrattative(){ $database=new Database(); $trattative=array(); $query="SELECT id FROM trattativa "; $database->query($query); $res=$database->result; $i=0; while($riga=mysql_fetch_array($res)){ $trattativa=new Trattativa(); $id=$riga[0]; $trattativa->select($riga[0]); $trattative[$i]=$trattativa; $i=$i+1; } if(isset($trattative)) return $trattative; else return null; } } ?>
true
2022403b3f8393397741cbc2778b8ca05dd46a30
PHP
jaybril/www.juice.com
/frontend/models/Join.php
UTF-8
1,826
2.671875
3
[ "BSD-3-Clause" ]
permissive
<?php namespace frontend\models; use common\widgets\Variable; use yii; use yii\db\ActiveRecord; class Join extends ActiveRecord{ /* * 通过id查找 */ public function findById($id){ $model = Join::find()->where(array('id' => $id))->one(); if ($model) { return new static($model); } return null; } /* * 添加一个申请 */ public function addOneJoin($username,$mobile,$company,$industry,$email,$nature,$inCity,$area,$inMoney,$inCount,$inPlace,$hardwareSource,$experience,$inSource){ $model=new Join(); $model->username=$username; $model->mobile=$mobile; $model->company=$company; $model->industry=$industry; $model->email=$email; $model->nature=$nature; $model->inCity=$inCity; $model->area=$area; $model->inMoney=$inMoney; $model->inPlace=$inPlace; $model->inCount=$inCount; $model->hardwareSource=$hardwareSource; $model->experience=$experience; $model->inSource=$inSource; $model->status=0; $model->applyTime=date('Y-m-d H:i:s',time());; $model->addTime=date('Y-m-d H:i:s',time()); // $model->addUser=Yii::$app->session->get(Variable::$session_userId_str); if($model->save()){ return true; } return false; } /* * 更新申请状态 */ public function updateJoinStatus($id,$status){ $model = Join::findOne($id); if(!$model){ return false; } $model->status=$status; $model->addTime=date('Y-m-d H:i:s',time()); $model->addUser=Yii::$app->session->get(Variable::$session_userId_str); if($model->save()){ return true; } return false; } }
true
22c8955608691d847401d309aca4edbd142d61f4
PHP
islandfuture/4yell
/task1/classes/SquareShapeHtml5Render.php
UTF-8
470
2.921875
3
[]
no_license
<?php class SquareShapeHtml5Render implements ShapeRender { public static function draw(AbstractShape $oShape) { $sResult = <<<EOT context.beginPath(); context.rect({$oShape->x}, {$oShape->y}, {$oShape->w}, {$oShape->h}); context.fillStyle = '{$oShape->bgColor}'; context.fill(); context.lineWidth = {$oShape->border}; context.strokeStyle = '{$oShape->color}'; context.stroke(); EOT; return $sResult; } }
true
8e2518f76768ba44ba0bc76a7163763cafe9267e
PHP
PHProger-themus/design-patterns
/Command/classes/NotifierCommand.php
UTF-8
277
3.078125
3
[]
no_license
<?php namespace command\classes; use command\interfaces\Command; class NotifierCommand implements Command { public function __construct( private string $line ) {} public function execute() { echo "You were notified: {$this->line}"; } }
true
887576586af2732d97bb5f530ee963f333f3038a
PHP
bwoebi/operators
/DoYouMissPointers.php
UTF-8
914
3.96875
4
[]
no_license
<?php /* pretty pointless ... but cool all the same */ class StringPointer implements Operators { private $string; private $position; private $end; public function __construct(&$string){ $this->string = $string; $this->position = 0; $this->end = strlen($string); } public function __operators($opcode, $zval = null) { switch($opcode) { case OPS_POST_INC: $this->position++; return 0; case OPS_PRE_INC: ++$this->position; return 0; case OPS_POST_DEC: $this->position--; return 0; case OPS_PRE_DEC: --$this->position; return 0; } } public function __toString(){ if ($this->position < $this->end) return (string) $this->string[$this->position]; else return ""; } } $string = "The Cow Jumped Over The Moon"; $pointer = new StringPointer($string); while(((string)$pointer)) { printf("%s", (string)$pointer); ++$pointer; } ?>
true
ec789aab1b7d7b08d2079ab3cfe49cf034b03ee9
PHP
gabriel-lm/Online-Voting-System
/ajax/register.php
UTF-8
3,829
2.546875
3
[]
no_license
<?php // Allow the config define('__CONFIG__', true); // Require the config require_once('E:\Learning\PHP Login Udemy\inc\config.php'); use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\PHPMailer; if($_SERVER['REQUEST_METHOD'] == 'POST'){ //Always return JSON format //header('Content-Type: application/json'); $return = []; $email = Filter::String($_POST['email']); // Make sure the user does not exist $user_found = User::Find($email); if($user_found){ // User exists // We can also check to see it they cand log in. $return['error'] = "This email is already being used"; $return['is_logged_in'] = false; } else { // User doesn't exist. Add them now. //Generating email verification token $confirmCode = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789!$/()*'; $confirmCode = str_shuffle($confirmCode); $confirmCode = substr($confirmCode, 0, 10); $fname = ($_POST['fname']); $lname = ($_POST['lname']); $county = ($_POST['county']); $addr = ($_POST['addr']); $cnp = ($_POST['cnp']); $sn = ($_POST['sn']); $password = password_hash($_POST['password'], PASSWORD_DEFAULT); $addUser = $con->prepare("INSERT INTO users(firstname, lastname, county, address, cnp, series_nr, email, password, confirm_code) VALUES(:fname, :lname, :county, :addr, :cnp, :sn, LOWER(:email), :password, :confirmCode)"); $addUser->bindParam(':fname', $fname, PDO::PARAM_STR); $addUser->bindParam(':lname', $lname, PDO::PARAM_STR); $addUser->bindParam(':county', $county, PDO::PARAM_STR); $addUser->bindParam(':addr', $addr, PDO::PARAM_STR); $addUser->bindParam(':cnp', $cnp, PDO::PARAM_INT); $addUser->bindParam(':sn', $sn, PDO::PARAM_STR); $addUser->bindParam(':email', $email, PDO::PARAM_STR); $addUser->bindParam(':password', $password, PDO::PARAM_STR); $addUser->bindParam(':confirmCode', $confirmCode, PDO::PARAM_STR); $addUser->execute(); $user_id = $con->lastInsertId(); //$_SESSION['user_id'] = (int) $user_id; $mail = new PHPMailer(true); // Passing `true` enables exceptions //Server settings $mail->SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->SMTPAuth = true; // Enable SMTP authentication //Recipients $mail->setFrom('donotreplay@voteonline.com', 'VoteOnline'); $mail->addAddress($email, $fname); // Add a recipient //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = "Your VoteOnline account: Email address verification"; $mail->Body = "You have been registered! <br></br> Please verify your email address by clicking the link below: <br></br> <a href='http://loginphpsite/confirm.php?email=$email&confirmCode=$confirmCode'>Click here!</a>"; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); $mail->smtpClose(); //UIkit.notification('You have been registered! Please check your email for confirmation!'); $return['redirect'] = '/login.php?message=confirm-email-first'; //$return['is_logged_in'] = true; //echo "Please Check Your Email Before Logging In!"; //echo "<script>setTimeout(\"location.href = '/login.php';\",1500);</script>"; } //Make sure the user CAN be added AND is added //Return the propper information back to JavaScript to redirect us. echo json_encode($return, JSON_PRETTY_PRINT); exit; }else { //Die. Kill the script. Redirect the user. exit('Invalid URL'); } ?>
true
bd50cddc0496fc65623ce2c1788009c00d460089
PHP
vairogs/vairogs
/src/Vairogs/Functions/Tests/DateTest.php
UTF-8
3,669
2.609375
3
[ "MIT" ]
permissive
<?php declare(strict_types = 1); namespace Vairogs\Functions\Tests; use DateTimeInterface; use Exception; use InvalidArgumentException; use Vairogs\Core\Tests\VairogsTestCase; use Vairogs\Functions\Date; class DateTest extends VairogsTestCase { /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderValidateDate */ public function testValidateDate(string $date, bool $expected): void { $this->assertEquals(expected: $expected, actual: (new Date())->validateDate(date: $date)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderGetDateWithoutFormat */ public function testGetDateWithoutFormat(string $date): void { $this->assertInstanceOf(expected: DateTimeInterface::class, actual: (new Date())->getDateWithoutFormat(date: $date)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderGetDateWithoutFormatWrong */ public function testGetDateWithoutFormatWrong(string $date): void { $this->assertNotInstanceOf(expected: DateTimeInterface::class, actual: (new Date())->getDateWithoutFormat(date: $date)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderExcelDate */ public function testExcelDate(int $timestamp, string $expected): void { $this->assertEquals(expected: $expected, actual: (new Date())->excelDate($timestamp)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderFormatDate */ public function testFormatDate(string $date, string $format, string $expected): void { $this->assertEquals(expected: $expected, actual: (new Date())->formatDate(string: $date, format: $format)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderFormatDateWrong */ public function testFormatDateWrong(string $date, string $format): void { $this->assertFalse(condition: (new Date())->formatDate(string: $date, format: $format)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderCreateFromUnixTimestamp * * @throws Exception */ public function testCreateFromUnixTimestamp(int $timestamp, ?string $format, string $expected): void { $this->assertEquals(expected: $expected, actual: (new Date())->createFromUnixTimestamp(timestamp: $timestamp, format: $format)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderGetDateNullable */ public function testGetDateNullable(?string $date, ?string $format, ?string $expected): void { $this->assertEquals(expected: $expected, actual: (new Date())->getDateNullable(dateString: $date, format: $format)?->format(format: Date::FORMAT)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderGetDate */ public function testGetDate(string $date, string $format, string $expected): void { $this->assertEquals(expected: $expected, actual: (new Date())->getDate(dateString: $date, format: $format)->format(format: $format)); } /** * @dataProvider \Vairogs\Functions\Tests\DataProvider\DateDataProvider::dataProviderGetDateWrong */ public function testGetDateWrong(?string $date, ?string $format): void { $this->expectException(exception: InvalidArgumentException::class); (new Date())->getDate(dateString: $date, format: $format); } }
true
93f7a8449f8ab257756c744fb3d691cbea61410e
PHP
NguyenHuy-pro/3dtfcom
/app/Models/Manage/Content/Building/Activity/TfBuildingActivity.php
UTF-8
6,150
2.53125
3
[ "MIT" ]
permissive
<?php namespace App\Models\Manage\Content\Building\Activity; use Illuminate\Database\Eloquent\Model; class TfBuildingActivity extends Model { protected $table = 'tf_building_activities'; protected $fillable = ['activity_id', 'highlight', 'action', 'created_at', 'building_id', 'articles_id', 'post_id']; protected $primaryKey = 'activity_id'; public $timestamps = false; private $lastId; #========== ========== ========== INSERT && UPDATE ========= ========== ========== #---------- ---------- Insert ---------- ---------- public function insert($buildingId, $articlesId = null, $postId = null) { $hFunction = new \Hfunction(); $modelBuildingActivity = new TfBuildingActivity(); $modelBuildingActivity->highlight = 0; $modelBuildingActivity->created_at = $hFunction->carbonNow(); $modelBuildingActivity->articles_id = $articlesId; $modelBuildingActivity->building_id = $buildingId; $modelBuildingActivity->post_id = $postId; if ($modelBuildingActivity->save()) { $this->lastId = $modelBuildingActivity->activity_id; return true; } else { return false; } } //get new id after insert public function insertGetId() { return $this->lastId; } #---------- ---------- Update info ---------- ---------- //delete public function actionDelete($activityId = null) { if (empty($activityId)) $activityId = $this->postId(); if (TfBuildingActivity::where('activity_id', $activityId)->update(['action' => 0])) { } } //per building only has a highlight post public function hideActivity($activityId = null) { if (empty($activityId)) $activityId = $this->postId(); return TfBuildingActivity::where('activity_id', $activityId)->update(['action' => 0]); } #========== ========== ========== RELATION ========= ========== ========== #----------- TF-BUILDING-ARTICLES ----------- public function buildingArticles() { return $this->belongsTo('App\Models\Manage\Content\Building\Service\Articles\TfBuildingArticles', 'articles_id', 'articles_id'); } public function deleteByBuildingArticles($articlesId) { return TfBuildingActivity::where('articles_id', $articlesId)->update(['action' => 0]); } #----------- TF-BUILDING-POST ----------- public function buildingPost() { return $this->belongsTo('App\Models\Manage\Content\Building\Post\TfBuildingPost', 'post_id', 'post_id'); } public function deleteByBuildingPost($postId) { return TfBuildingActivity::where('post_id', $postId)->update(['action' => 0]); } #----------- TF-BUILDING ----------- public function building() { return $this->belongsTo('App\Models\Manage\Content\Building\TfBuilding', 'building_id', 'building_id'); } public function deleteByBuilding($buildingId) { return TfBuildingActivity::where('building_id', $buildingId)->update(['action' => 0]); } public function infoHighLightOfBuilding($buildingId) { return TfBuildingActivity::where(['building_id' => $buildingId, 'highlight' => 1, 'action' => 1])->first(); } # get activity of building public function infoOfBuilding($buildingId, $take = null, $dateTake = null, $highlight = 0) { if (empty($take) && empty($dateTake)) { return TfBuildingActivity::where(['building_id' => $buildingId, 'highlight' => $highlight, 'action' => 1])->orderBy('created_at', 'DESC')->get(); } else { return TfBuildingActivity::where(['building_id' => $buildingId, 'highlight' => $highlight, 'action' => 1])->where('created_at', '<', $dateTake)->orderBy('activity_id', 'DESC')->skip(0)->take($take)->get(); } } #========== ========== ========== GET INFO ========= ========== ========== public function getInfo($activityId = null, $field = null) { if (empty($activityId)) { return TfBuildingActivity::where('action', 1)->get(); } else { $result = TfBuildingActivity::where(['activity_id' => $activityId, 'action' => 1])->first(); if (empty($field)) { return $result; } else { return $result->$field; } } } public function pluck($column, $objectId = null) { if (empty($objectId)) { return $this->$column; } else { return TfBuildingActivity::where('activity_id', $objectId)->pluck($column); } } public function activityId() { return $this->activity_id; } # get building intro public function buildingId($activityId = null) { return $this->pluck('building_id', $activityId); } public function articlesId($activityId = null) { return $this->pluck('articles_id', $activityId); } public function postId($activityId = null) { return $this->pluck('post_id', $activityId); } public function createdAt($activityId = null) { return $this->pluck('created_at', $activityId); } //check activity object public function checkBuildingArticles($activityId = null) { return (empty($this->articlesId($activityId))) ? false : true; } public function checkBuildingPost($activityId = null) { return (empty($this->postId($activityId))) ? false : true; } //total public function totalRecords() { return TfBuildingActivity::count(); } // total public function totalActivityRecords() { return TfBuildingActivity::where('action', 1)->count(); } #========== ========== ========== CHECK INFO ========= ========== ========== public function checkActivityPost($activityId = null) { return (empty($this->postId($activityId))) ? false : true; } public function checkActivityArticles($activityId = null) { return (empty($this->articlesId($activityId))) ? false : true; } }
true
045e62984b3d2e4f8bf3f6bbc547f572d36f8143
PHP
bekanntmacher/contao-anchor
/elements/ContentAnchorHeadline.php
UTF-8
763
2.546875
3
[]
no_license
<?php /** * Contao Open Source CMS * * Copyright (C) 2005-2013 Leo Feyer * * @package anchornavi * @author Simon Wohler <mail@bekanntmacher.ch> * @license LGPL * @copyright bekanntmacher 2012 */ /** * Run in a custom namespace, so the class can be replaced */ namespace Contao; /** * Class ContentAnchorHeadline * * Front end content element "anchorheadline". * @copyright bekanntmacher 2013 * @author Simon Wohler <https://contao.org> * @package Core */ class ContentAnchorHeadline extends \ContentElement { /** * Template * @var string */ protected $strTemplate = 'ce_anchorheadline'; /** * Generate the content element */ protected function compile() { $this->Template->anchor = standardize($this->headline) . '-' . $this->id; } }
true
ab541f41427f1447e9e589d9283cd7f77c33d26c
PHP
okimangelo/vicparks
/site/web/app/themes/vicparks-theme/templates/single/park-gallery.php
UTF-8
1,662
2.578125
3
[ "MIT" ]
permissive
<?php /** * Template Part: Gallery for Single Park Page */ $images = get_field('gallery'); // check if the repeater field for Slider has rows of data if( have_rows('gallery') ): ?> <section id="parkCarousel" class="carousel slide park-slider" data-ride="carousel" style="min-height: 400px;"> <!-- Indicators --> <ol class="carousel-indicators"> <?php $slide_number = 0; foreach( $images as $image ): ?> <li data-target="#parkCarousel" data-slide-to="<?php echo $slide_number;?>" class="<?php echo ($slide_number == 0)? 'active':''; ?>"></li> <?php $slide_number++; endforeach; ?> </ol> <!-- Wrapper for slides --> <aside class="carousel-inner" role="listbox"> <?php // loop through the rows of data $slide_number = 0; foreach( $images as $image ):?> <div class="item <?php echo ($slide_number == 0)? 'active':''; ?>" style="background: url('<?php echo $image['url']; ?>') no-repeat center / cover; min-height: 400px;"> </div> <?php $slide_number++; endforeach; ?> </aside> <!-- Left and right controls --> <a class="left carousel-control" href="#parkCarousel" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#parkCarousel" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </section> <?php else : // no rows found ?> <?php endif; ?>
true
11032ef52f9e833bf567c6b116ad945947a4da1f
PHP
lucasmichel/mete_service
/src/model/DAO/AcaoDAO.php
UTF-8
5,688
3.03125
3
[]
no_license
<?php /** * Classe AcaoDAO * Camada de acesso a dados da entidade Ação * @package model * @subpackage DAO */ class AcaoDAO extends ClassDAO { /** * Atributos */ private static $instancia; private $conexao; const TABELA = 'acoes'; /** * Metodo construtor() */ protected function __construct(){ parent::__construct("acoes"); $this->conexao = Connect::getInstancia(); } /** * Metodo getInstancia() */ public static function getInstancia(){ if(!isset(self::$instancia)) self::$instancia = new AcaoDAO(); return self::$instancia; } /** * Metodo inserir($obj) * @param $obj * @return Perfil */ public function inserir(Acao $obj) { // INSTRUCAO SQL // $sql = "INSERT INTO " . self::TABELA . " (id_modulo, codigo_acao, nome, sub_menu, excluido) VALUES('" . $obj->getModulo()->getId() . "', '" . $obj->getCodigoAcao() . "', '" . $obj->getNome(). "', '" . $obj->getSubMenu(). "', 0)"; // EXECUTANDO A SQL // $resultado = $this->conexao->exec($sql); // TRATANDO O RESULTADO // ($resultado) ? $obj->setId(mysql_insert_id()) : $obj = $resultado; // RETORNANDO O RESULTADO // return $obj; } /** * Metodo editar($obj) * @param $obj * @return Perfil */ public function editar(Acao $obj) { // INSTRUCAO SQL // $sql = "UPDATE " . self::TABELA . " SET codigo_acao = '" . $obj->getCodigoAcao() . "', nome = '" . $obj->getNome() . "', sub_menu = '" . $obj->getSubMenu() . "' WHERE id_modulo = '" . $obj->getModulo()->getId() . "' and id = '".$obj->getId()."' "; // EXECUTANDO A SQL // $resultado = $this->conexao->exec($sql); // RETORNANDO O RESULTADO // return $obj; } /** * Metodo buscar($codigo,$modulo) * @param $codigo * @param $modulo * @return fetch_assoc */ public function buscar($codigo = 0,$modulo = 0){ // FILTRO // $where = array(); if(!empty($codigo)) $where[] = " a.codigo_acao = '".$codigo."' "; if(!empty($modulo)) $where[] = " a.id_modulo = '".$modulo."' "; $where = (count($where) ? ' WHERE ' . implode(' AND ',$where) : ''); // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a " . @$where. "and a.excluido = '0' "; // EXECUTANDO A SQL // $resultado = $this->conexao->fetch($sql); // RETORNANDO O RESULTADO // return $resultado; } /** * Metodo listar($filtroModulo) * @param $filtroModulo * @return fetch_assoc[] */ public function listarComFiltro($filtroModulo){ // FILTRO // $where = array(); if(!empty($filtroModulo)) $where[] = " a.id_modulo = '".$filtroModulo."' "; $where = (count($where) ? ' WHERE ' . implode(' AND ',$where) : ''); // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a " . @$where . " and a.excluido = '0' ORDER BY a.nome"; // EXECUTANDO A SQL // $resultado = $this->conexao->fetchAll($sql); // RETORNANDO O RESULTADO // return $resultado; } public function listarPorModulo ($idModulo){ // FILTRO // // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a where a.id_modulo = '".$idModulo."' and a.excluido = '0' ORDER BY a.codigo_acao"; // EXECUTANDO A SQL // $resultado = $this->conexao->fetchAll($sql); // RETORNANDO O RESULTADO // return $resultado; } public function buscarNomeAcao($nome, $modulo){ // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a where a.nome = '".$nome."' and a.id_modulo = '".$modulo."' and a.excluido = '0'"; // EXECUTANDO A SQL // $resultado = $this->conexao->fetch($sql); // RETORNANDO O RESULTADO // return $resultado; } public function buscarCodigoAcao($codigoAcao, $modulo){ // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a where a.codigo_acao = '".$codigoAcao."' and a.id_modulo = '".$modulo."' and a.excluido = '0'"; // EXECUTANDO A SQL // $resultado = $this->conexao->fetch($sql); // RETORNANDO O RESULTADO // return $resultado; } public function buscarNomeAcaoEdicao($id, $nome, $modulo){ // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a where a.nome = '".$nome."' and a.id_modulo = '".$modulo."' and a.id <>'".$id."' and a.excluido = '0' "; // EXECUTANDO A SQL // $resultado = $this->conexao->fetch($sql); // RETORNANDO O RESULTADO // return $resultado; } public function buscarCodigoAcaoEdicao($id, $codigoAcao, $modulo){ // INSTRUCAO SQL // $sql = "SELECT a.* FROM " . self::TABELA . " a where a.codigo_acao = '".$codigoAcao."' and a.id_modulo = '".$modulo."' and a.id <>'".$id."' and a.excluido = '0' "; // EXECUTANDO A SQL // $resultado = $this->conexao->fetch($sql); // RETORNANDO O RESULTADO // return $resultado; } public function excluirRelacionamentoAcaoModuloPerfil(Acao $obj){ $sql = "DELETE from acoes_modulos_perfis WHERE id_modulo = '" . $obj->getModulo()->getId() . "' and codigo_acao = '".$obj->getCodigoAcao()."' "; // EXECUTANDO A SQL // $resultado = $this->conexao->fetch($sql); // RETORNANDO O RESULTADO // return $resultado; } } ?>
true
2a6669dd2ba7f4ee1214bd5006205942294dceef
PHP
deekshith4450/online-book-store
/src/payments.php
UTF-8
1,600
2.578125
3
[]
no_license
<?php $con=mysqli_connect('localhost','root','','project2'); $add=$_POST['address']; if(!$con) { echo "could not connect"; } else { $pricefecth=mysqli_query($con,"SELECT SUM(price) FROM addtocart"); $totalprice=mysqli_fetch_row($pricefecth); $price=number_format($totalprice[0],2); $edd=date("dS - F",strtotime("+7 days")); echo "<table align=\"center\" bgcolor=\"#99ccff\" width=\"30%\">"; echo "<tr><td><h3>Payments</h3></td></tr>"; echo "<tr><td><b>Total Price:</b>$$price</td></tr>"; echo "<tr><td><b>Delivery date:</b>$edd</td></tr>"; echo "<tr><td><b>Delivery Address:</b>$add</td></tr>"; echo "<tr><td><h3>Select payment method</h3></td></tr>"; echo "<form method=\"post\" action=\"lastpage.php?add=$add&price=$price&edd=$edd\">"; echo "<tr><td><input type=\"radio\" name=\"payments\" value=\"Debit card\">Debit Card</td></tr>"; echo "<tr><td><input type=\"radio\" name=\"payments\" value=\"Credit Card\">Credit Card<br></td></tr>"; echo "<tr><td><input type=\"radio\" name=\"payments\" value=\"Pay on Delivery\">Pay on Delivery<br></td></tr>"; echo "<tr><td><b>Online Banking:</b><select name=\"bank\">"; echo "<option value=\"Select you Bank\" Selected=\"Selected\">Select You Bank</option>"; echo "<option value=\"Bank of America\" >Bank of America</option>"; echo "<option value=\"Wells Fargo\" >Wells Fargo</option>"; echo "<option value=\"Regions\" >Regions</option>"; echo "<option value=\"Chase\" >Chase</option>"; echo "</select></td></tr>"; echo "<tr><td><input type=\"submit\" value=\"Pay\" ></td></tr>"; echo "</table>"; } ?>
true
c732363dfcff649118c03e0e88a86019979744d0
PHP
Mazen-Al-Samman/yii2-advanced-debugger
/src/ResponsePanel.php
UTF-8
878
2.59375
3
[]
no_license
<?php namespace samman\debug; use Yii; use yii\debug\Panel; use yii\web\Response; /** * Debugger panel that collects and displays request data. * @author Mazen Samman <mazenalsmman@gmail.com> * @since 2.0 */ class ResponsePanel extends Panel { /** * {@inheritdoc} */ public function getName(): string { return 'Response'; } /** * {@inheritdoc} */ public function getSummary(): string { return ''; } /** * {@inheritdoc} */ public function getDetail(): string { return Yii::$app->view->renderFile(__DIR__ . '/views/responseDetails.php', ['panel' => $this]); } /** * {@inheritdoc} */ public function save() { $responseModel = new Response(); $responseModel->data = Yii::$app->getResponse()->data; return ['response' => $responseModel]; } }
true
1a7e6dbcb83cde66252b0dad3a773edb33b00ef8
PHP
MauroRFuentes/IPOO
/Teatro2/funciones.php
UTF-8
2,054
3.546875
4
[]
no_license
<?php class Funciones{ private $nombre; private $horarioInicio; private $duracionObra; private $precio; public function __construct($nombre,$horarioInicio,$duracionObra,$precio){ $this->nombre = $nombre; $this->horarioInicio = $horarioInicio; $this->duracionObra = $duracionObra; $this->precio = $precio; } public function setNombre($nombre){ $this->nombre = $nombre; } public function getNombre(){ return $this->nombre; } public function setHorarioInicio($horarioInicio){ $this->horarioInicio = $horarioInicio; } public function getHorarioInicio(){ return $this->horarioInicio; } public function setDuracionObra($duracionObra){ $this->duracionObra = $duracionObra; } public function getDuracionObra(){ return $this->duracionObra; } public function setPrecio($precio){ $this->precio = $precio; } public function getPrecio(){ return $this->precio; } public function cambiarNombre($nuevoNombre,$numFuncion){ $nombreFuncion = $this->getNombre(); $nombreFuncion[$numFuncion - 1] = $nuevoNombre; $this->setNombre($nombreFuncion); } public function cambiarPrecio($nuevoPrecio,$numFuncion){ $precioFuncion = $this->getPrecio(); $precioFuncion[$numFuncion - 1] = $nuevoPrecio; $this->setPrecio($precioFuncion); } public function __toString() { $funciones = ""; for ($j=0;$j<count($this->getNombre());$j++){ $funciones = $funciones."Funcion Nº".($j+1)." :".$this->getNombre()[$j]. "\nHorario de Inicio: ".$this->getHorarioInicio()[$j]." / Duración: ".$this->getDuracionObra()[$j]. "min \nPrecio: $".$this->getPrecio()[$j]."\n"."-------------------------------------------\n"; } return $funciones; } }
true
30baf91b5e32fed3e7ef81dcedb7133eb2f738e9
PHP
DoubleDoorDevelopment/Website
/getTwitchName.php
UTF-8
1,750
2.625
3
[]
no_license
<?php header('Content-Type:text/plain'); if (!isset($_GET["uuid"])) { http_response_code(400); echo "Returns Twitch username associated with a Minecraft UUID.\n"; echo "Usage:\n\t?uuid='uuid as string'\n"; echo "Result:\n"; echo "\tHTTP 200 Plain text twitch username if uuid is in the database, empty response otherwise.\n"; echo "\tHTTP 4xx If uuid isn't the proper format (32 or 36 char, alphanumerical).\n"; echo "\tHTTP 5xx If there's fire coming out of the server.\n"; die("\nSee https://github.com/DoubleDoorDevelopment/Website for more information."); } // This amount of fraud / error detection is probably more then strictly required, but better safe then sorry. switch (strlen($_GET['uuid'])) { default: http_response_code(400); die("Your UUID needs to be in 32 char (no dashes) or 36 char (with dashes) alphanumeric format."); //c93ca410800340ef81d7ac88719e2038 case 32: $uuid = $_GET['uuid']; break; //c93ca410-8003-40ef-81d7-ac88719e2038 case 36: $uuid = str_replace('-', '', $_GET['uuid']); break; } if (!ctype_alnum($uuid)) { http_response_code(400); die("Your UUID needs to be in 32 char (no dashes) or 36 char (with dashes) alphanumeric format."); } try { include "mysql.inc.php"; $db = makeDBConnection(); $stmt = $db->prepare("SELECT Twitch FROM minecraft WHERE UUID=? AND TwitchVerified = 1"); $stmt->execute(array($uuid)); echo $stmt->fetch(PDO::FETCH_NUM)[0]; } catch (Exception $e) { http_response_code(500); error_log($e->getMessage()); die("The server *may* be on fire. Please contact admin dries007 net (fill in an at and period) with some information about what happened."); }
true
393de5a9f2e0550781624acf55d7840e818948df
PHP
DimitrisKas/PLH518-Cloud-Services-Course
/main_app/app/async/favorite_toggle.php
UTF-8
1,072
2.59375
3
[]
no_license
<?php session_start(); header('Content-type: application/json'); include_once '../db_scripts/Models/Users.php'; include_once '../db_scripts/Models/Favorites.php'; include_once('../db_scripts/keyrock_api.php'); include_once('../Utils/Random.php'); include_once('../Utils/Logs.php'); logger("-- In ADD/DELETE Favorite"); // Check if User is logged in if (isset($_SESSION['login']) && $_SESSION['login'] === true) { // User already logged in... logger("User: " . $_SESSION['user_username']); logger("Role: " . $_SESSION['user_role']); $data = json_decode(file_get_contents('php://input'), true); If (isset($data['movie_id'])) { logger("Is favorite: " .$data['addFavorite']); if ($data['addFavorite'] == "true") $success_flag = User::AddFavorite($_SESSION['user_id'], $data['movie_id']); else $success_flag = User::DeleteFavorite($_SESSION['user_id'], $data['movie_id']); echo json_encode($success_flag); exit(); } } // If failed for any reason... echo json_encode(false);
true
3267bc9f952987261b27149c0126bfeb7c0c683a
PHP
Danilovdenis1105/news-blog
/classes/User.php
UTF-8
964
2.953125
3
[]
no_license
<?php class User extends Database { public function isAuthorized($login, $password) { $user = $this->getUser($login); $isAutho = password_verify($password, $user['password']); if ($isAutho) { return true; } return false; } public function getUser($login) { $sql = "select * from users where login like '$login' limit 1;"; $result = $this->dbConnect->query($sql); if ($result) { return $result->fetch_assoc(); } return null; } public function addUser($login, $password) { $password = password_hash($password, PASSWORD_DEFAULT); $sql = "INSERT INTO users (login, password) values ('$login','$password')"; $this->dbConnect->query($sql); } public function deleteUser($id) { $sql = "DELETE FROM users WHERE `users`.`id` = $id limit 1;"; $this->dbConnect->query($sql); } }
true
fa8914c3e4272e016d6d8dd735f79e0c7c4ddeee
PHP
joerncodes/pathfinderdb
/src/Domain/EventSubscriber/SerializeEventSubscriber.php
UTF-8
1,337
2.53125
3
[]
no_license
<?php namespace App\Domain\EventSubscriber; use ApiPlatform\Core\EventListener\EventPriorities; use App\Domain\PropertySorting\PropertySorter; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\ViewEvent; use Symfony\Component\HttpKernel\KernelEvents; class SerializeEventSubscriber implements EventSubscriberInterface { /** * @var PropertySorter */ private $propertySorter; public function __construct(PropertySorter $propertySorter) { $this->propertySorter = $propertySorter; } public static function getSubscribedEvents() { return [ KernelEvents::VIEW => ['sortParams', EventPriorities::POST_SERIALIZE], ]; } public function sortParams(ViewEvent $event) { $result = json_decode($event->getControllerResult()); if($result === null) { return $event; } if(is_array($result)) { foreach($result as $key => $row) { $result[$key] = $this->propertySorter->sort($row); } } else { if(!is_object($result)) { return $event; } $result = $this->propertySorter->sort($result); } return $event->setControllerResult(json_encode($result)); } }
true
4f6cd5459c5f9b0f4a62bbd39312e6f0cb93bf6f
PHP
sergli/DbUtils
/src/DbUtils/Adapter/AdapterTrait.php
UTF-8
2,528
3.109375
3
[]
no_license
<?php namespace DbUtils\Adapter; use DbUtils\Select\SelectInterface; use DbUtils\Table\TableInterface; use DbUtils\Table\AbstractTable; use DbUtils\Table\TableNotExistsException; trait AdapterTrait { /** * Возвращает объект таблицы * * @param string $tableName * @access public * @return TableInterface * @throws TableNotExistsException */ public function getTable($tableName) { return AbstractTable::factory($this, $tableName); } /** * Проверяет, существует ли таблица * * @param string $tableName имя таблицы * @return boolean */ public function tableExists($tableName) { try { $this->getTable($tableName); return true; } catch (TableNotExistsException $e) { return false; } } /** * fetchRow * * @param string $sql * @access public * @return array */ public function fetchRow($sql) { $it = $this->query($sql); if (!$it) { return null; } // Возвращаем первую же строку foreach ($it as $row) { $it = null; return $row; } } /** * fetchOne * * @param string $sql * @access public * @return string|null */ public function fetchOne($sql) { $row = $this->fetchRow($sql); if (empty($row)) { return null; } return current($row); } public function fetchPairs($sql) { $it = $this->query($sql); $pairs = []; foreach ($it as $row) { if (count($row) < 2) { throw new \Exception('Количество колонок меньше двух'); } $pairs[current($row)] = next($row); } $it = null; return $pairs; } public function fetchAll($sql) { $it = $this->query($sql); $all = iterator_to_array($it); $it = null; return $all; } /** * fetchColumn * * @param string $sql * @param int $colNum * @access public * @return array * @throws \Exception */ public function fetchColumn($sql, $colNum = 1) { if ($colNum < 1) { throw new \Exception('Неверный номер колонки'); } $it = $this->query($sql); $ret = []; $flag = true; // чтоб сто раз не вызывать count foreach ($it as $row) { if ($flag && count($row) < $colNum) { throw new \Exception('Неверный номер колонки'); } $flag = false; $ret[] = $row[array_keys($row)[$colNum - 1]]; } $it = null; return $ret; } public function fetchCol($sql, $column = 1) { return $this->fetchColumn($sql, $column); } }
true
3465de5454f6b72f76feffe6fd0bbd7beea25d55
PHP
quwahara/hello-lib
/src/Hello.php
UTF-8
150
2.9375
3
[]
no_license
<?php namespace quwahara\HelloLib; class Hello { public function helloTo($subject) { return "Hello, {$subject}"; } }
true
fe29220101051ff4a4724b0c46f59d58b9940e29
PHP
tommy-bolger/necrolab-deprecated
/external/oauth2-reddit-master/src/Grant/InstalledClient.php
UTF-8
972
2.71875
3
[ "MIT" ]
permissive
<?php namespace Rudolf\OAuth2\Client\Grant; use League\OAuth2\Client\Grant\GrantInterface; use League\OAuth2\Client\Token\AccessToken; /** * @see https://github.com/reddit/reddit/wiki/OAuth2 */ class InstalledClient implements GrantInterface { public function __toString() { return 'https://oauth.reddit.com/grants/installed_client'; } public function prepRequestParams($defaultParams, $params) { if ( ! isset($params["device_id"]) || empty($params["device_id"])) { throw new \BadMethodCallException("Missing device_id"); } // device_id has to be a 20-30 character ASCII string if ( ! preg_match("/^[[:ascii:]]{20,30}$/", $params["device_id"])) { throw new \InvalidArgumentException("Invalid device_id"); } return array_merge($defaultParams, $params); } public function handleResponse($response = []) { return new AccessToken($response); } }
true
a7542f730f0738400afecc095525025e8531dd14
PHP
developernca/ffh
/application/core/MY_Controller.php
UTF-8
2,920
2.6875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
<?php /** * Base class for all other controllers in this * application. Every controller should extend this * controller and not directly extend CI_Controller. * * @author Nyein Chan Aung<developernca@gmail.com> */ class MY_Controller extends CI_Controller { /** * Initialize parent constructor and * load helpers and libraries if not null. * auto load libraries : user_agent, constant * auto load helpers : url * * @param array $helper_name_list helpers * @param array $library_name_list libraries * @param array $model_name_list models */ public function __construct($helper_name_list = null, $library_name_list = null, $model_name_list = null) { parent::__construct(); if (!empty($helper_name_list) && !is_null($helper_name_list)) { $this->load->helper($helper_name_list); } if (!empty($library_name_list) && !is_null($library_name_list)) { $this->load->library($library_name_list); } if (!empty($model_name_list) && !is_null($model_name_list)) { $this->load->model($model_name_list); } $this->load->database(); } /** * authenticate every request. */ protected function authenticate() { $session_id = $this->session->userdata(Constant::SESSION_USSID); //get_cookie(Constant::COOKIE_USSID); if (!is_null($session_id)) { if ($this->account->is_activated($this->session->userdata(Constant::SESSION_USSID), $this->session->userdata(Constant::SESSION_EMAIL))) { return Constant::AUTH_ALREADY_LOGIN; } else if (!$this->account->is_activated($this->session->userdata(Constant::SESSION_USSID), $this->session->userdata(Constant::SESSION_EMAIL))) { return Constant::AUTH_ACTIVATION_REQUIRED; } } else { $this->session->unset_userdata(Constant::SESSION_USSID); return Constant::AUTH_SESSION_NOT_EXIST; } } /** * load view * @param string $name name of view to load * @param array $view_data data to use in view and should only be non nested key-value array[optional] */ protected function load_view($name, $view_data = null) { $data['view'] = $name; $data['is_mobile'] = $this->agent->is_mobile(); if (!is_null($view_data)) { foreach ($view_data as $key => $value) { $data[$key] = $value; } } $this->load->view('main_view', $data); } /** * Sign out */ protected function signout() { $this->session->sess_destroy(); redirect(base_url()); exit(); } protected function send_activation_mail($to, $code) { $message = sprintf(Constant::ACTIVATION_MAIL_BODY, $code); mail($to, Constant::ACTIVATION_MAIL_SUBJECT, $message, Constant::HTML_MAIL_HEADER); } }
true
6d8c5e8aa85a4556d50005a97cc9ada9ecbd8c93
PHP
sygatechnology/sygaigniter
/app/Services/ApiRequestService.php
UTF-8
1,291
2.59375
3
[ "MIT" ]
permissive
<?php namespace App\Services; use CodeIgniter\HTTP\RequestInterface; class ApiRequestService { public function getParam(string $param) { return $this->_getParam($param); } public function params(){ return $this->_getParam(); } public function getToken(){ $request = \Config\Services::request(); $authorization = $request->getHeaderLine( 'Authorization' ); if( ! empty($authorization) ){ $segment = explode(" ", $authorization); if(count($segment) == 2){ return $segment[1]; } } return$this-> _getParam( 'token' ); } private function _getParam(string $param = null){ $request = \Config\Services::request(); $jsonParams = (array) $request->getJSON(); $varParams = (array) $request->getVar(); $postGetParams = (array) $request->getPostGet(); $getPostParams = (array) $request->getGetPost(); $rawParams = (array) $request->getRawInput(); $params = array_merge($jsonParams, $varParams, $postGetParams, $getPostParams, $rawParams); if(! is_null($param)) return (isset($params[$param])) ? $params[$param] : null; return $params; } }
true
e639c463b4d4e23da5fa1607b0298a3a0eb0bf8d
PHP
antonioTov/app
/controller/playersController.php
WINDOWS-1251
9,017
2.65625
3
[]
no_license
<? /** * */ class PlayersController extends System_Controller { /** * */ public function init() { // $this->view->ident = $this->ident; $request = new Component_Request(); // if( $request->post('event') ) { $this->event( $request->post('event') ); } } /** * */ public function indexAction() { $this->view->cache->getCache(); $xcache = new Component_XCache(); if($data = $xcache->get('players')){ $data = unserialize($data); echo 'cache'; } else { $model = new System_Model(); $players = $model->players; $data = $players->getAll(); $xcache->set('players', serialize($data)); } $this->view->players = $data; } /** * */ public function addAction() { $request = new Component_Request(); // , if ( $request->post() ) { $this->validProcess($request); } // , , // $this->view->context = 'add'; // ID , $this->view->admin_id = $this->ident->getId(); // $this->view->legend = Widget_Legend::getEditLegend(' ','New player'); // $this->view->tpl('form'); } /** * */ public function editAction() { $request = new Component_Request(); if ( $request->post() ) { $this->validProcess( $request ); } // ID $url = new System_Url(); $player_id = $url->get(2,'int'); // $model = new System_Model(); $player = $model->players; $data = $player->getById($player_id); if($data){ // foreach( $data as $key => $val ) { $this->view->$key = $val; } $this->view->context = 'edit'; $this->view->player_id = $player_id; $this->view->admin_id = $data->admin_id; $this->view->legend = Widget_Legend::getEditLegend(' ','New player'); $this->view->tpl('form'); } else { $this->call( array( 'controller' =>'error', 'action' => 'error404' )); exit; } } /** * */ public function deleteAction() { $url = new System_Url(); $player_id = $url->get(2,'int'); $model = new System_Model(); $player = $model->players; if( $player->delete( $player_id ) ) { $this->redirect('/'); } else { $this->call( array( 'controller' =>'error', 'action' => 'error404' )); exit; } } /** * */ public function searchAction() { $model = new System_Model(); $players = $model->players; $admins = $model->administrators; $columns = $players->getColumns(); $condition = ''; if ( !empty( $_GET ) ) { // GET- , // foreach ( $_GET as $key => $val ) { if ( !empty( $val ) ) { if ( in_array( $key, $columns ) ) { // , ID if ( $key == 'admin_id') { $admin_name = $admins->getByUserName( $val )->id; $val = ($admin_name) ? $admin_name : 'null'; } // $condition .= $players->table() . '.' . $key . " LIKE '%" . $players->escape( $val ) . "%' OR "; } } } // , if ( !$condition ) { $condition = ' 0 '; $this->view->errorEmpty = true; } else { $condition = substr($condition, 0, -3); } // foreach( $_GET as $key => $val ) { $this->view->$key = $val; } } // $this->view->showSearchForm = true; $this->view->players = $players->search($condition); $this->view->count = $players->count; $this->view->tpl('index'); } /** * * @param $request */ private function validProcess( $request ) { $data = array( 'username' => $request->post('username'), 'first_name' => $request->post('first_name'), 'last_name' => $request->post('last_name'), 'birth_date' => $request->post('birth_date'), 'email' => $request->post('email'), 'admin_id' => $request->post('admin_id','integer') ); // . $context = $request->post('context'); $model = new System_Model(); $player = $model->players; $validator = new Component_Validator(); if( $validator->is_valid($data) ) { // $playerData = $validator->getData(); // $playerData['player_id'] = $request->post('player_id','integer'); // if( $player->getByName( $playerData['username'] ) && $context != 'edit' ) { // , username $this->view->errors = array('username' => true); } // first_name if (!$validator->checkLength( $playerData['first_name'] )) { $this->view->errors = array( 'length' => System_Config::get('input_max_len'), 'name' => 'First name' ); } // last_name if (!$validator->checkLength( $playerData['last_name'] )) { $this->view->errors = array( 'length' => System_Config::get('input_max_len'), 'name' => 'Last name' ); } // Email if (!$validator->checkEmail( $playerData['email'] )) { $this->view->errors = array('email' => true); } // , if(!$this->view->errors) { if( $player->$context( $playerData ) ) { $xcache = new Component_XCache(); $xcache->remove('players'); $this->redirect('/'); } } } else { $this->view->errors = array('empty' => true); } // foreach( $data as $key => $val ) { $this->view->$key = $val; } } /** * * Ajax */ public function checkloginAction() { $request = new Component_Request(); if( $request->isAjax() ) { $username = $request->post('username'); $model = new System_Model(); $player = $model->players; if( $player->getByName( $username ) ) { echo json_encode( array( 'match' => true ) ); } else { echo json_encode( array( 'match' => false ) ); } } exit; } /** * * , * @param $event * @return bool */ private function event($event) { $request = new Component_Request(); $model = new System_Model(); $player = $model->players; if( $items = $request->post('check') ) { $ids = ''; foreach( $items as $id) { $ids .= $id.", "; } $ids = substr($ids, 0, -2); if($event == 'delete') { $player->deleteByIds($ids); } } return true; } }
true
b3c3cd0ab31cb4ddf527eb1dad418660b4b417c9
PHP
skesslr/loCal
/public/tag.php
UTF-8
1,795
2.859375
3
[]
no_license
<?php // configuration require("../includes/config.php"); // if user reached page via GET (as by clicking a link or via redirect) if ($_SERVER["REQUEST_METHOD"] == "GET") { // else render form render("tag_form.php", ["calendar_id" => $_GET["id"], "title" => "Tag"]); } // else if user reached page via POST (as by submitting a form via POST) else if ($_SERVER["REQUEST_METHOD"] == "POST") { // validate submission if (empty($_POST["calendar_id"])) { apologize("You must provide a calendar id."); } if (empty($_POST["tag"])) { apologize("You must provide a tag."); } //make sure submission is unique $rows = CS50::query("SELECT * FROM tags WHERE tag = ? AND calendar_id = ?", $_POST["tag"], $_POST["calendar_id"]); if (count($rows) == 1) { apologize("This calendar already has this tag."); } $cals = CS50::query("SELECT * FROM calendars WHERE id = ?", urldecode($_POST["calendar_id"])); if (count($cals) == 0) { apologize("We don't have this calendar yet.".($_POST["calendar_id"])); } // ensure user is the one who uploaded the calendar $users = CS50::query("SELECT * FROM users WHERE id = ?", $_SESSION["id"]); if ( $users[0]["id"] == $cals[0]["user_id"]) { // Insert new tag CS50::query("INSERT INTO tags (tag, calendar_id) VALUES(?, ?)", $_POST["tag"], $cals[0]["id"]); } else { apologize("Only the uploader can add tags to a calendar."); } // redirect back redirect("uploads.php"); } ?>
true
27ced45e0824e00d41f74b83e764a6a3976dc0ad
PHP
NightZpy/test-geopagos
/Clases/Usuario.php
UTF-8
3,002
2.65625
3
[ "MIT" ]
permissive
<?php require_once ('Model.php'); require_once ('Pago.php'); require_once ('Favorito.php'); /** * */ class Usuario extends Model { protected $attributes = ['codigo_usuario', 'usuario', 'clave', 'edad']; protected $tableName = 'usuarios'; protected $primaryKey = 'codigo_usuario'; protected $validationRules = [ 'usuario' => 'required', 'edad' => 'min:19' ]; /*protected $relations = [ 'favoritos' => ['hasMany' => ['Favorito' => 'codigo_usuario', 'pivot' => 'favoritos']], 'pagos' => ['hasMany' => ['Pago' => 'codigo_usuario', 'pivot' => 'pago_usuario']] ];*/ public function pagos($pagos = null) { /*if (isset($this->relations)) { $relationTypes = key($this->relations); if (in_array('manyToMany', $relationTypes)) { $relation = $this->relations['manyToMany']; if (is_a($pagos, 'Usuario')) { } elseif (is_array($pagos)) { } } }*/ if ($pagos) { if (is_a($pagos, 'Pago')) { $this->savePagoUsuario($pagos); } elseif (is_array($pagos)) { foreach ($pagos as $pago) { $this->savePagoUsuario($pago); } } return 1; } $pagoUsuario = new PagoUsuario; $pagosUsuario = $pagoUsuario->findBy('codigo_usuario', $this->codigoUsuario); $pagos = []; foreach ($pagosUsuario as $pagoUsuario) { $pago = $pagoUsuario->pago(); $pagos[] = $pago; } return $pagos; } private function savePagoUsuario($pago) { $pagoUsuario = new PagoUsuario; $pagoUsuario->codigoUsuario = $this->codigoUsuario; $pagoUsuario->codigoPago = $pago->codigoPago; $pagoUsuario->save(); } public function favoritos($favoritos = null) { /*if (isset($this->relations)) { $relationTypes = key($this->relations); if (in_array('manyToMany', $relationTypes)) { $relation = $this->relations['manyToMany']; if (is_a($pagos, 'Usuario')) { } elseif (is_array($pagos)) { } } }*/ if ($favoritos) { if (is_a($favoritos, 'Favorito')) { $this->saveUsuarioFavorito($favoritos); } elseif (is_array($favoritos)) { foreach ($favoritos as $favorito) { $this->saveUsuarioFavorito($favorito); } } return 1; } $favorito = new Favorito; $favoritos = $favorito->findBy('codigo_usuario', $this->codigoUsuario); $favs = []; foreach ($favoritos as $favorito) { $fav = $favorito->usuarioFavorito(); $favs[] = $fav; } return $favs; } private function saveUsuarioFavorito($usuario) { $favorito = new Favorito; $favorito->codigoUsuario = $this->codigoUsuario; $favorito->codigoUsuarioFavorito = $usuario->codigoUsuario; $favorito->save(); } public function delete($field = null) { $pagoUsuario = new PagoUsuario; $pagosUsuario = $pagoUsuario->findBy('codigo_usuario', $this->codigoUsuario); foreach ($pagosUsuario as $pagoUsuario) $pagoUsuario->delete('codigo_usuario'); parent::delete(); } }
true
f91214ede8694fb26980897e4c7fa56aab8721b2
PHP
mufee/mufee
/fuel/app/classes/controller/ajax.php
UTF-8
2,094
2.609375
3
[ "MIT" ]
permissive
<?php /** * The Welcome ajax rest controller. * * @package app * @author MT2 Team * @extends Controller_Rest * * 説明:ajaxリクエスト用 */ class Controller_Ajax extends Controller_Rest { /** * @brief [曲の再生後処理] * @param [musicname] [曲名] * @param [musicinfo] [曲情報] * @access public * @return Response */ public function post_musicoperate() { $musicname = $_POST['name']; // 曲情報を取得 $musicinfo = Model_Music::getOneMusic($musicname); // musiccountsに曲idをinsert Model_Musiccount::setcount($musicinfo[0]["id"]); // 再生履歴追加処理 if (Auth::check()) { $userid = Auth::get_user_id()[1]; // 履歴情報を追加 Model_Musichistory::sethistory($userid, $musicinfo[0]["id"], $musicinfo[0]["artistid"]); } } public function post_nextpaging() { $userid = Auth::get_user_id()[1]; switch ($_POST['name']) { case "favorite": $result = Model_Mynews::getNextNews($userid, $_POST['page']); break; } $this->response(json_encode($result), 200); } // 2013/12/20 石田追加 public function post_addmylist() { // マイリスト情報を挿入 $data = array( 'userid' => $ID[] = $_POST['u_id'], // ユーザID取得 'artistid' => $ID[] = $_POST['a_id'], // 選択アーティストID取得 ); //SQLの発行 $query = DB::insert('mylists')->set($data)->execute(); } public function post_deletemylist() { $data = array( 'userid' => $ID[] = $_POST['u_id'], // ユーザID取得 'artistid' => $ID[] = $_POST['a_id'], // 選択アーティストID取得 ); //SQLの発行 $query = DB::delete('mylists') ->where('userid', $data['userid']) ->and_where('artistid', $data['artistid']) ->execute(); } } ?>
true
520ba62b26bef265688169435eb6c2019ff578a3
PHP
anilmomin/Anil-Projects-PHP
/DTP-5-11-2012/application/models/winefeedback.php
UTF-8
2,514
2.734375
3
[]
no_license
<?php require_once 'ditchthepitchmodel.php'; class WineFeedback extends DitchThePitchModel { public function __construct() { parent::__construct(); $this->tableName = TABLE_WINEFEEDBACK; $this->addPrimaryKey('winefeedbackId'); } /** * getwineFeedback * Returns the Feedback * * @param mixed $params This is a description * @param mixed $page This is a description * @return mixed This is the return value description * */ public function getFeedback($params = "" , $page = "all") { $this->db->select("*")->from( $this->tableName); $query = ''; $result = array(); if (!empty($params)) { if ( (($params ["num_rows"] * $params ["page"]) >= 0 && $params ["num_rows"] > 0)) { if ($params ["search"] === TRUE) { $ops = array ( "eq" => "=", "ne" => "<>", "lt" => "<", "le" => "<=", "gt" => ">", "ge" => ">=" ); } if ( !empty ($params['search_field_1'])) { $this->db->where ($params['search_field_1'], $params['user_id']); } if ( !empty ($params['search_field_2'])) { $this->db->where ($params['search_field_2'], "1"); } //$this->db->order_by( "{$params['sort_by']}", $params ["sort_direction"] ); if ($page != "all") { $this->db->limit ($params ["num_rows"], $params ["num_rows"] * ($params ["page"] - 1) ); } $query = $this->db->get(); $result = $query->result_array(); } } else { $this->db->limit (5); $query = $this->db->get ($this->_table); $result = $query->result_array(); } return $result; } public function getAvgPrice($wineId) { $this->db->select_avg('estimateValue'); $this->db->where('wineId', $wineId); $result = $this->db->get($this->tableName); if($result) return $result->result(); return null; } public function getFeedBackDate($userId) { $this->db->select('claim_date'); $this->db->from('user_profiles'); $this->db->where('user_id', $userId); $results = $this->db->get(); $results = $results->row(); if($results) { return $results; } else { return null; } } } ?>
true
19a930dd0eea099ca150316cf71fb2629014632b
PHP
BensonDu/laravel
/app/Http/Middleware/Init.php
UTF-8
2,208
2.59375
3
[ "MIT" ]
permissive
<?php namespace App\Http\Middleware; use Closure; use App\Http\Model\Admin\UserModel; class Init { /* |-------------------------------------------------------------------------- | 全局初始化 |-------------------------------------------------------------------------- */ public function handle($request, Closure $next) { $this->set_env_public(); $this->set_env_admin(); $this->set_env_platform(); return $next($request); } /* |-------------------------------------------------------------------------- | 设置全局变量 公共 |-------------------------------------------------------------------------- */ private function set_env_public(){ $session = session(); $_ENV['uid'] = $session->get('uid'); } /* |-------------------------------------------------------------------------- | 设置全局变量 admin |-------------------------------------------------------------------------- */ private function set_env_admin(){ if(isset($_ENV['uid']) && isset($_ENV['domain']['id'])){ $roles = UserModel::get_user_role($_ENV['uid']); $role = 0; foreach ($roles as $v){ //平台管理员默认拥有所有子站权限 if($v->site_id == $_ENV['domain']['id'] || $v->site_id == '0'){ $role = intval($v->role); break; } } $_ENV['admin']['role'] = $role; } } /* |-------------------------------------------------------------------------- | 设置全局变量 platform |-------------------------------------------------------------------------- */ private function set_env_platform(){ $c_base = config('site.platform_base'); $c_prefix = config('site.platform_prefix_home'); $c_cdn = config('site.platform_cdn_domain'); $prefix = is_null($c_prefix) ? '' : $c_prefix.'.'; $_ENV['platform']['home'] = 'http://'.$prefix.$c_base; $_ENV['platform']['domain'] = $c_base; $_ENV['platform']['cdn'] = $c_cdn; } }
true
610cedb7c0d91b0d7884bf625994de790367b8e1
PHP
ReubenTanYuErn/Agile-Development---Penang
/penang/tourism/admin_area/inc/update.php
UTF-8
2,541
2.875
3
[]
no_license
<!DOCTYPE html> <?php include("includes/db.php"); function getPosts() { //expect data to get are 1 id, 1 name, 1 image and 1 description $posts = array(); $posts[0] = $_POST['id']; $posts[1] = $_POST['name']; $posts[2] = $_FILES['image']; $posts[3] = $_POST['description']; return $posts; } //Update the information if(isset($_POST['update'])) { $data = getPosts(); $update_Query = "UPDATE `users` SET `name`='$data[1]',`image`='$data[2]',`desciption`=$data[3] WHERE `id` = $data[0]"; try{ $update_Result = mysqli_query($con, $update_Query); if($update_Result) { if(mysqli_affected_rows($con) > 0) { echo 'Data Updated'; }else{ echo 'Data Not Updated'; } } } catch (Exception $ex) { echo 'Error Update '.$ex->getMessage(); } } ?> <html> <body> <form action="firstPage.php?update" method="post" enctype="multipart/form-data"> <table align="center" width="700" border="0" bgcolor=""> <tr align="center"> <td colspan="7"><u><h2 style="font-family : Helvetica;font-size:45px;font-weight:bolder;">Update Information</u></h2></td><br/> </tr> <tr> <td align="right"><b style="font-family : Helvetica;font-size:24px;">Name:</b></td> <td><input type="text" name="name" size="60" id="name" required/></td> </tr> <tr> <td align="right"><b style="font-family : Helvetica;font-size:24px;">Image:</b></td> <td><input type="file" name="shopping_image" id="image"/></td> </tr> <tr> <td align="right"><b style="font-family : Helvetica;font-size:24px;">Description:</b></td> <td><textarea type="text" rows="9" cols="60" name="desc" id="desc"></textarea></td> </tr> <tr> <td colspan="7"><br/><input type="submit" style="background-color:#7B4A12; height:50px; font-size:25px;font-family:Helvetica;cursor:pointer;" name="update" value="Search" /></td> <td colspan="7"><br/><input type="submit" style="background-color:#7B4A12; height:50px; font-size:25px;font-family:Helvetica;cursor:pointer;" name="update" value="Update" /></td> </tr> </table> </form> </body> </html>
true
9398d672152166f5a7f2247ea62a97465102a797
PHP
juicylevel/sarkazyaka
/server/db/AppDB.php
UTF-8
7,945
3.046875
3
[]
no_license
<?php require_once 'utils.php'; require_once 'DBWrapper.php'; /** * Класс-обёртка для работы с БД приложения. * Выполняет конкретные запросы к БД. */ class AppDB extends DBWrapper { //------------------------------------------------------------------------- // Работа с пользователями прложения //------------------------------------------------------------------------- /** * Получение идентификатора текущего пользователя по socialId. * * @param $userSocialId Идентификатор пользователя в социальной сети. * @param int Идентификатор пользователя в БД приложения. */ public function getUserId ($userSocialId) { $sql = 'SELECT id FROM user WHERE social_id = ' . $userSocialId; $stmt = $this->pdo->query($sql); $result = $stmt->fetch(PDO::FETCH_OBJ); return $result->id; } //------------------------------------------------------------------------- // Работа с записями //------------------------------------------------------------------------- /** * Добавление новой записи. * * @param $title string Заголовок записи. * @param $userId int Идентификатор пользователя. * @return int Идентификатор добавленной записи. */ public function addRecord ($record) { return $this->insert('record', $record)[0]; } /** * Обновление полей таблицы record. * * @param $id int Идентификатор записи. * @param $fields array Обновляемые поля таблицы record. */ public function updateRecord ($record) { return $this->update('record', $record); } /** * Получение списка записей. * * @param $offset int Начальная позиция. * @param $count int Количество. * @return array */ public function getRecords ($offset = null, $count = null) { $sql = 'SELECT record.*, user.id as userId, user.social_id as ' . 'userSocialId FROM record, user WHERE record.user_id = user.id ' . 'ORDER BY record.create_date DESC '; if (!empty($offset) && !empty($count)) { $sql .= 'LIMIT ' . $offset . ',' . $count; } $stmt = $this->pdo->query($sql); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); return $result; } //------------------------------------------------------------------------- // Работа с тэгами записи //------------------------------------------------------------------------- /** * Добавление тэгов к записи. * * @param $recordTags array Список тэгов записи. * @return array Идентификаторы добавленнных тэгов записи. */ public function addRecordTags ($recordTags) { return $this->insert('record_tag', $recordTags); } /** * Удаление тэгов записи. * * @param $recordId Идентификатор записи. * @param $tagsIds Идентификаторы тэгов. */ public function deleteRecordTags ($recordId, $tagsIds) { $recordTagsIds = $this->getRecordTagsIds($recordId, $tagsIds); $this->delete('record_tag', $recordTagsIds); } /** * Получение списка id записей в таблице record_tag по значениям * поля tag_id. * * @param $tagsIds array Список id записей в таблице tag. * @return $result array Список id записей в таблице record_tag. */ private function getRecordTagsIds ($recordId, $tagsIds) { $sql = 'SELECT id FROM record_tag WHERE record_id = :recordId ' . 'AND tag_id IN (' . join(',', $tagsIds) . ')'; $stmt = $this->pdo->prepare($sql); $stmt->bindValue(':recordId', $recordId); $stmt->execute(); return $stmt->fetchAll(PDO::FETCH_COLUMN); } /** * Получение тэгов записей. * * @param $recordIds array Идентификаторы записей. * @return array */ public function getRecordsTags ($recordIds) { $sql = 'SELECT tag.*, record_tag.* FROM tag, record_tag ' . 'WHERE record_tag.record_id IN (' . implode(',', $recordIds) . ') ' . 'AND record_tag.tag_id = tag.id'; $stmt = $this->pdo->query($sql); return $stmt->fetchAll(PDO::FETCH_ASSOC); } /** * Создание тэга. * * @param $tag array Данные создаваемого тэга. */ public function createTag ($tag) { return $this->insert('tag', $tag); } /** * Обновление тэга. * * @param $tag array Данные обновляемого тэга. */ public function updateTag ($tag) { $this->update('tag', $tag); } /** * Получение списка всех тэгов. * * @return array */ public function getAllTags () { $sql = 'SELECT * FROM tag ORDER BY id DESC'; $stmt = $this->pdo->query($sql); return $stmt->fetchAll(PDO::FETCH_ASSOC); } //------------------------------------------------------------------------- // Работа с элементами контента записи //------------------------------------------------------------------------- /** * Добавление элементов содержимого записи. * * @param $contentItems Элементы контента записи. * @return array Идентификаторы добавленнных элементов. */ public function addRecordContentItems ($contentItems) { return $this->insert('content_item', $contentItems); } /** * Обновление элементов контента записи. * * @param $contentItems array Список элементов контента. */ public function updateContentItems ($contentItems) { $this->update('content_item', $contentItems); } /** * Удаление элементов контента записи. * * @param $contentItemsIds Идентификаторы элементов контента записи. */ public function deleteContentItems ($contentItemsIds) { $this->delete('content_item', $contentItemsIds); } /** * Получение типов элементов контента по id. * * @param $contentItemsIds array Идентификаторы элементов контента. * @return array Массив типов array(0 => array(id => id, type => type)). */ public function getContentItemsTypes ($contentItemsIds) { $sql = 'SELECT id, type FROM content_item WHERE id IN (' . join(',', $contentItemsIds) . ')'; $stmt = $this->pdo->query($sql); return $stmt->fetchAll(PDO::FETCH_ASSOC); } /** * Получение элементов контента записей. * * @param $recordIds array Идентификаторы записей. * @return array */ public function getRecordsContentItems ($recordIds) { $sql = 'SELECT * FROM content_item WHERE record_id IN (' . implode(',', $recordIds) . ')'; $stmt = $this->pdo->query($sql); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); return $result; } } ?>
true
1f99b28af299b68ed17a70fa654230f525359381
PHP
sriastuti/tubespw-karangsong
/tubesPW/admin/modul/galeri.php
UTF-8
2,741
2.546875
3
[]
no_license
<?php include '../database/koneksi.php'; switch(@$_GET['act']){ default: echo "<h2>Galeri</h2> <form method=post action='?module=galeri&act=tambahgaleri'> <input class='btn btn-primary' type=submit value='Tambah Galeri'> </form> <table class='table'> <tr> <th scope='col'>No</th> <th scope='col'>Nama Galeri</th> <th scope='col'>Gambar</th> <th scope='col'>Keterangan</th> </tr>"; $tampil=mysqli_query($koneksi, "select * from tabel_image order by id_image"); $no=1; while ($r=mysqli_fetch_array($tampil)) { echo "<tr><td>$no</td> <td>$r[nama_gambar]</td> <td><img src='galeri/$r[gambar]' width='50'></td> <td>$r[ket]</td> <td><a class='btn btn-primary' href=?module=galeri&act=editgaleri&id=$r[id_image]>Edit</a> <a class='btn btn-danger' href=\"aksi.php?module=galeri&act=hapus&id=$r[id_image]\"onClick=\"return confirm('apakah anda benar akan menghapus galeri $r[id_image]?')\">Hapus</a> </td></tr>"; $no++; } echo "</table>"; break; //tambah galeri case "tambahgaleri": echo "<h2>Tambah galeri</h2> <form name='form1' method='post' action='aksi.php?module=galeri&act=input' enctype='multipart/form-data'> <div class='col-md-5'> <div class='form-group'> <input class='form-control' name='nama_gambar' type='text' size='35' placeholder='Enter Name Galeri'> </div> <div class='form-group'> <input name='gambar' type=file > </div> <div class='form-group'> <textarea id='mytextarea' name='ket'></textarea> </div> <input type='submit' class='btn btn-primary' name='submit' value='Simpan'> <input type=button class='btn btn-danger' value=Batal onclick=self.history.back()> </div> </form>"; break; //edit galeri case "editgaleri": $edit=mysqli_query($koneksi, "select * from tabel_image where id_image='$_GET[id]'"); $r=mysqli_fetch_array($edit); echo "<h2>Edit galeri</h2> <form name='form1' method='post' action='aksi.php?module=galeri&act=update' enctype='multipart/form-data'> <div class='col-md-5'> <div class='form-group'> <input type=hidden name=id value='$r[id_image]'> <input class='form-control' name='nama_gambar' type='text' size='35' value='$r[nama_gambar]'> </div> <div class='form-group'> <div class='form-group'> <img src='galeri/$r[gambar]' width='50'><br> <input name='gam_baru' type=file size='30'> </div> <textarea id='mytextarea' class='form-control' name='ket' cols='35' rows='4' placeholder='Enter Keterangan'>$r[ket]</textarea> </div> <input type='submit' class='btn btn-primary' value='Update'> <input type=button class='btn btn-danger' value=Batal onclick=self.history.back()> </div> </form>"; break;} ?> <script type="text/javascript" src="../tinymce/tiny_mce.js"></script> <script type="text/javascript"> tinymce.init({ selector: "#mytextarea" }); </script>
true
028f896ab0f5d513d610abfc8d8390784bcd14a9
PHP
take64/CitrusFramework3
/tests/Variable/DatesTest.php
UTF-8
1,119
2.84375
3
[ "MIT" ]
permissive
<?php declare(strict_types=1); /** * @copyright Copyright 2019, CitrusFramework. All Rights Reserved. * @author take64 <take64@citrus.tk> * @license http://www.citrus.tk/ */ namespace Test\Variable; use Citrus\Variable\Dates; use PHPUnit\Framework\TestCase; /** * 日付拡張のテスト */ class DatesTest extends TestCase { /** * @test */ public function 現時刻取得() { // 現時点のタイムスタンプ $dates = Dates::now(); $ts1 = $dates->format('U'); // 比較用  $ts2 = time(); // 検算(連続で処理しているので、1秒以内であるべき) $this->assertLessThanOrEqual(1, abs($ts1 - $ts2)); } /** * @test */ public function 現時刻取得_オブジェクトは違うが時間は同じ() { $dt1 = Dates::now(); $dt2 = Dates::now(); // 検算(オブジェクトは違う) $this->assertNotSame($dt1, $dt2); // 検算(時間はマイクロ秒で同じ) $this->assertSame($dt1->format('u'), $dt2->format('u')); } }
true
e7ebab77a537fc46095140ff6b757a62ce62b439
PHP
munza/lumen-api-starter
/app/Transformers/ErrorTransformer.php
UTF-8
3,342
2.6875
3
[ "MIT" ]
permissive
<?php namespace App\Transformers; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Http\Response; use Illuminate\Validation\ValidationException; use League\Fractal\TransformerAbstract; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Throwable; class ErrorTransformer extends TransformerAbstract { /** * A Fractal transformer. * * @param Throwable $user * @return array */ public function transform(Throwable $exception): array { $error = [ 'message' => (string) $this->parseMessage($exception), 'status' => (int) $this->parseStatusCode($exception), ]; if (count($details = $this->parseDetails($exception))) { $error['details'] = $details; } if (config('app.debug')) { $error['debug'] = [ 'exception' => get_class($exception), 'trace' => $this->parseTrace($exception), ]; } return $error; } /** * Get the message of the exception. * * @param Throwable $exception * @return string */ protected function parseMessage(Throwable $exception): string { if (!config('app.debug') && Response::HTTP_INTERNAL_SERVER_ERROR === $this->parseStatusCode($exception)) { return "Something went wrong!"; } switch (true) { case $exception instanceof NotFoundHttpException: return "Not found"; // Add custom messages for other exceptions. } if (method_exists($exception, 'getMessage') && ($message = $exception->getMessage()) != '') { return $message; } return "Something went wrong!"; } /** * Get the status code of the exception. * * @param Throwable $exception * @return int */ protected function parseStatusCode(Throwable $exception): int { switch (true) { case $exception instanceof ModelNotFoundException: case $exception instanceof NotFoundHttpException: return Response::HTTP_NOT_FOUND; case $exception instanceof ValidationException: return Response::HTTP_UNPROCESSABLE_ENTITY; // Add custom status code for other exceptions. } if (method_exists($exception, 'getStatusCode')) { return $exception->getStatusCode(); } if (property_exists($exception, 'status')) { return $exception->status; } return Response::HTTP_INTERNAL_SERVER_ERROR; } /** * Get the details of the exception. * * @param Throwable $exception * @return array */ protected function parseDetails(Throwable $exception): array { if (method_exists($exception, 'getDetails')) { return $exception->getDetails(); } if (method_exists($exception, 'errors')) { return $exception->errors(); } return []; } /** * Get the trace of the exception. * * @param Throwable $exception * @return array */ protected function parseTrace(Throwable $exception): array { return preg_split("/\n/", $exception->getTraceAsString()); } }
true
8669c470096e26c3a8c20fc05dd95b3a34076fe5
PHP
yancey1204/PHPwebsite
/YanceySite/ITA2/Model/image.php
UTF-8
376
3.078125
3
[]
no_license
<?php class image { public $ImageID; public $ImageDes; public $SectionID; public $ImageExtension; // CONSTRUCTOR function image($imageid, $imagedes, $imageextension, $sectionid) { $this->ImageID = $imageid; $this->ImageDes = $imagedes; $this->ImageExtension = $imageextension; $this->SectionID = $sectionid; } }
true
9630e63e0dbd8dbe8d4593da43a97a511449ccd1
PHP
Ashu7777/Hospital-management-php
/Hospital_Manag_php_project/functions.php
UTF-8
3,243
2.609375
3
[]
no_license
<?php function openConnection(){ global $connection; $server = "127.0.0.1"; $user = "root"; $password = ""; $dbaseName = "hospital"; $connection = mysqli_connect($server, $user, $password) or exit("Server connection failed"); mysqli_select_db($connection, $dbaseName) or exit("Database $dbaseName selection failed"); mysqli_set_charset($connection, "utf-8"); } function closeConnection(){ global $connection; mysqli_close($connection); } function createDatabase() { $connection = mysqli_connect("127.0.0.1", "root", "") or exit("Server connection failed"); $dbaseName = 'hospital'; echo "<h3>Hospitals Management</h3> <br>"; mysqli_query($connection, "CREATE DATABASE `$dbaseName` DEFAULT CHARACTER SET utf8 COLLATE utf8_polish_ci;") or exit("Creating database failed"); } function createTables() { global $connection; $query = "create table doctors " . "(id int NOT NULL AUTO_INCREMENT ," . "name varchar(32), " . "surname varchar(32), " . "specialty varchar(32), " . "employmentDate DATE, PRIMARY KEY (`id`))"; mysqli_query($connection, $query) or exit("Query $query failed"); $query = "create table patients " . "(id int NOT NULL AUTO_INCREMENT ," . "name varchar(32), " . "surname varchar(32), " . "gender varchar(6), " . "DateOfBirth DATE, PRIMARY KEY (`id`))"; mysqli_query($connection, $query) or exit("Query $query failed"); $query = "create table visits " . "(id int NOT NULL AUTO_INCREMENT ," . "name varchar(32), " . "surname varchar(32), " . "startDate DATETIME, " . "endDate DATETIME, " . "diagnosis varchar(50)," . "doctorInCharge varchar(32), PRIMARY KEY (`id`))"; ")"; mysqli_query($connection, $query) or exit("Query $query failed"); //echo $query; } function InsertTestData() { global $connection; $queries = array("insert into doctors values(null, 'John', 'Smith', 'Dentist', '2018-11-10');", "insert into doctors values(null, 'Valentine', 'Onah', 'Physicians', '2018-11-10');", "insert into doctors values(null, 'Luise', 'Luke', 'Neurologists', '2018-11-10');"); foreach($queries as $query) mysqli_query($connection, $query) or exit("Query $query failed"); $queries = array("insert into patients values(null, 'Jan', 'Paul', 'male', '1992-03-11');", "insert into patients values(null, 'Angela', 'Lukas', 'female', '1990-12-07');", "insert into patients values(null, 'Adam', 'Smith', 'male', '1997-09-18');"); foreach($queries as $query) mysqli_query($connection, $query) or exit("Query $query failed"); $queries = array("insert into visits values(null, 'Jan', 'Paul', '2018-04-06 15:30:00', '2018-11-10 13:50:10', 'canser', 'Dr. John Smith');", "insert into visits values(null, 'Angela', 'Lukas', '2017-01-11 16:30:00', '2017-05-18 19:10:00', 'headech', 'Dr. Valentine Onah');", "insert into visits values(null, 'Adam', 'Smith', '2016-08-26 19:30:00', '2016-02-27 11:33:50', 'fever', 'Dr. Luise Luke');"); foreach($queries as $query) mysqli_query($connection, $query) or exit("Query $query failed"); } ?>
true
a8eb701d317164850dc1d23743834a0d4792d970
PHP
kucik/thalie-web
/cls/CArticle.cls.php
UTF-8
3,352
2.53125
3
[]
no_license
<?php class CArticle { var $db; var $id; function CArticle(&$db, $id = '') { $this->db = $db; $this->load($id); } function load($id = 0) { $this->id = (int)$id; if (!$this->id) { $rs = $this->db->qy("SELECT id, name, url, level, lft, rght FROM category ORDER BY lft"); $this->items = $rs['rows']; } else { $rs = $this->db->qy("SELECT id, name, url, level, lft, rght, text FROM category ORDER BY lft"); $this->items = $rs['rows']; } } function update($param, $id='') { $qy = "UPDATE category SET text = '".addslashes($param['text'])."' WHERE id = ".$id; $rs = $this->db->qy($qy); //$this->level(); // $this->rebuild_tree($id); $this->load($id); } function get_name($id) { $rs = $this->db->qy("SELECT name FROM category WHERE id = '".$id."' "); return $rs['rows'][0]['name']; } function get_text($id) { $rs = $this->db->qy("SELECT text FROM category WHERE id = '".$id."' "); return $rs['rows'][0]['text']; } function get_url($id) { $rs = $this->db->qy("SELECT url FROM category WHERE id = '".$id."' "); return $rs['rows'][0]['url']; } function print_tpl(&$tpl, $items, $dynamic_block) { if(is_array($items)) { foreach ($items as $k=>$v) { if ($v['level'] == 3) { $rs = $this->db->qy("SELECT id,url FROM category WHERE lft <= '".$v['lft']."' AND rght >= '".$v['rght']."' ORDER BY lft DESC LIMIT 1 "); $parrent_url = $rs['rows'][0]['url'].'-'.$rs['rows'][0]['id'].'.htm'; /* $parrent_url = 'index.php?page='.$rs['rows'][0]['url'].'&id='.$rs['rows'][0]['id']; */ } $tpl->assign($v); $tpl->assign(array( 'CATEGORY_ID'=>$v['id'], // 'CATEGORY_LINK'=>($v['level'] == 3)?'<span class=\"sub'.($v['level']-1).'\">'.$v['name'].'</span>':'<a href="'.{HOME_URL}.$v['url'].'" class="sub'.($v['level']-1).'">'.$v['name'].'</a>', 'CLASS'=>($v['level'])?'sub'.($v['level']-1):'', 'C_CATEGORY_ACTIVE'=>($v['active'])?'active':'', 'CATEGORY_NAME'=>$v['name'], 'ARTICLE_NAME'=>$v['name'], 'ARTICLE_TEXT'=>$v['text'] )); $tpl->parse(strtoupper($dynamic_block),'.'.$dynamic_block); } } } function parse_tpl(&$tpl, $where_parse='', $tpl_file = '', $dynamic_block='category_list') { if ($tpl_file) {$tpl->define('category', $tpl_file); $tpl_name = 'category';} else $tpl_name = 'content'; $tpl->define_dynamic($dynamic_block, $tpl_name); $this->print_tpl($tpl, $this->items, $dynamic_block); if ($where_parse) $tpl->parse($where_parse,$tpl_name); } } ?>
true
bc61e402f1803e419686df5a7c098cde47b4ee90
PHP
PiosX/Course
/Sector 2/operatory_porównania.php
UTF-8
686
3.25
3
[]
no_license
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Operatory Porównania</title> </head> <body> <?php $zm = 5; $zm2 = '5'; //BOOL = true - 1 false - 0(nic) // var_dump($zm == $zm2); //dwa znaki równości służą do porównania // var_dump($zm != $zm2); //var_dump($zm <> $zm2); //czy są różne //var_dump($zm > $zm2); //var_dump($zm < $zm2); //var_dump($zm <= $zm2); //var_dump($zm === $zm2); var_dump($zm !== $zm2); ?> </body> </html>
true
94e4cf9dfd574e23479830edfbc41cee7af6420a
PHP
BagerManBG/PU-Code-Igniter
/app/Models/UserModel.php
UTF-8
588
2.8125
3
[ "MIT" ]
permissive
<?php namespace App\Models; use CodeIgniter\Model; use Config\Database; class UserModel extends Model { protected $table = 'users'; protected $allowedFields = ['name', 'email', 'password', 'created']; protected $returnType = 'App\Entities\User'; public function __construct() { parent::__construct(); $this->db = Database::connect(); } public function get_by_email($email) { $query = $this->db->query('select * from ' . $this->table . " WHERE email='$email'"); $result = $query->getResult(); return empty($result) ? FALSE : reset($result); } }
true
ad46734ffd19452959767bab9941a0f274e4a195
PHP
Zikstar/Comp5531-Web-Portal
/backend/employer.php
UTF-8
3,615
3.109375
3
[ "MIT" ]
permissive
<?php class Employer { private $db = null; public function __construct($db) { $this->db = $db; } public function findAll() { $statement = " SELECT Employer_ID, Description, Name, Emoloyer_Balance, EmMembershipStartTime, UserId, GenreEm FROM Employer; "; try { $statement = $this->db->query($statement); $result = $statement->fetchAll(\PDO::FETCH_ASSOC); return $result; } catch (\PDOException $e) { exit($e->getMessage()); } } public function find($id) { $statement = " SELECT Employer_ID, Description, Name, Emoloyer_Balance, EmMembershipStartTime, UserId, GenreEm FROM Employer WHERE Employer_ID = ?; "; try { $statement = $this->db->prepare($statement); $statement->execute(array($id)); $result = $statement->fetchAll(\PDO::FETCH_ASSOC); return $result; } catch (\PDOException $e) { exit($e->getMessage()); } } public function insert(Array $input) { $statement = " INSERT INTO Employer (Description, Name, Emoloyer_Balance, EmMembershipStartTime, UserId, GenreEm) VALUES (:Description, :Name, :Emoloyer_Balance, :EmMembershipStartTime, :UserId, :GenreEm); "; try { $statement = $this->db->prepare($statement); $statement->execute(array( 'Description' => $input['Description'] ?? null, 'Name' => $input['Name'] ?? null, 'Emoloyer_Balance' => $input['Emoloyer_Balance'], 'EmMembershipStartTime' => $input['EmMembershipStartTime'] ?? null, 'UserId' => $input['UserId'], 'GenreEm' => $input['GenreEm'] ?? null )); return $statement->rowCount(); } catch (\PDOException $e) { exit($e->getMessage()); } } public function update($id, Array $input) { $statement = " UPDATE Employer SET Description = :Description, Name = :Name, Emoloyer_Balance = :Emoloyer_Balance, EmMembershipStartTime = :EmMembershipStartTime, UserId = :UserId, GenreEm = :GenreEm, WHERE Employer_ID = :id; "; try { $statement = $this->db->prepare($statement); $statement->execute(array( 'Description' => $input['Description'] ?? null, 'Name' => $input['Name'] ?? null, 'Emoloyer_Balance' => $input['Emoloyer_Balance'], 'EmMembershipStartTime' => $input['EmMembershipStartTime'] ?? null, 'UserId' => $input['UserId'], 'GenreEm' => $input['GenreEm'] ?? null )); return $statement->rowCount(); } catch (\PDOException $e) { exit($e->getMessage()); } } public function delete($id) { $statement = " DELETE FROM Employer WHERE Employer_ID = :id; "; try { $statement = $this->db->prepare($statement); $statement->execute(array('id' => $id)); return $statement->rowCount(); } catch (\PDOException $e) { exit($e->getMessage()); } } } ?>
true
1e108ecd2253fce4bfa7ff7b9c467b0fc6799399
PHP
LazarPanchev/PHPWebDevelopment
/PHP Projects/MVC/WORKSHOPDatabaseDrivenApplicationShop/fileUpload.php
UTF-8
2,118
2.953125
3
[ "MIT" ]
permissive
<?php spl_autoload_register(); //auto include - the class name must be equal to file name $db = DBConnection::getConnection(); $products_obj = new Products($db); $currentDir = getcwd(); //return the current directory with the project $uploadDirectory = "/uploads/"; //here will save the files $errors = []; // Store all foreseen and unforseen errors here $fileExtensions = ['jpeg', 'jpg', 'png']; // Get all the file extensions allows extensions $fileName = $_FILES['myfile']['name']; //from inner array $_FILE $fileSize = $_FILES['myfile']['size']; $fileTmpName = $_FILES['myfile']['tmp_name']; $fileType = $_FILES['myfile']['type']; //$fileExtension = strtolower(end(explode('.', $fileName))); //take extension if error - from the reference $file = explode('.', $fileName); $fileExtension = strtolower(end($file)); $uploadPath = $currentDir . $uploadDirectory . basename($fileName); //take the path current dir and concatenate the other path if (isset($_POST['submit'])) { $productId = $_POST['product_id']; //comes from the hidden field $products_obj->uploadImage($fileName, $productId); header('Location: viewProduct.php?product_id=' . $productId . '&isUploaded=1'); if (!in_array($fileExtension, $fileExtensions)) { $errors[] = "This file extension is not allowed. Please upload a JPEG or PNG file"; } if ($fileSize > 2000000) { $errors[] = "This file is more than 2MB. Sorry, it has to be less than or equal to 2MB"; } if (empty($errors)) { $didUpload = move_uploaded_file($fileTmpName, $uploadPath); //physical put the file in the dir if ($didUpload) { // $baseFileName=basename($fileName); echo "The file " . basename($fileName) . " has been uploaded"; /* echo "<p class='paragraph'>The file <?= $baseFileName ?> has been uploaded</p>";*/ } else { echo "An error occurred somewhere. Try again or contact the admin"; } } else { foreach ($errors as $error) { echo $error . "These are the errors" . "\n"; } } } ?>
true
84448102c070e56b6d4908efba994871e213913a
PHP
giovictor/greenville
/changepassword.php
UTF-8
1,327
2.515625
3
[]
no_license
<?php session_start(); require "dbconnect.php"; if(isset($_POST['currentpassword']) && isset($_POST['newpassword']) && isset($_POST['confirmnewpassword'])) { $currentpassword = md5($_POST['currentpassword']); $newpassword = md5($_POST['newpassword']); if(isset($_SESSION['borrowerID'])) { $borrowerID = $_SESSION['borrowerID']; $borrowerSQL = "SELECT * FROM borrower WHERE IDNumber='$borrowerID'"; $borrowerQuery = mysqli_query($dbconnect, $borrowerSQL); $borrower = mysqli_fetch_assoc($borrowerQuery); $borrowerpassword = $borrower['password']; if($currentpassword!=$borrowerpassword) { echo "Invalid"; } else { $changepasswordSQL = "UPDATE borrower SET borrower.password='$newpassword' WHERE IDNumber='$borrowerID'"; $changepassword = mysqli_query($dbconnect, $changepasswordSQL); } } else if(isset($_SESSION['userID'])) { $userID = $_SESSION['userID']; $userSQL = "SELECT * FROM user WHERE userID='$userID'"; $userQuery = mysqli_query($dbconnect, $userSQL); $user = mysqli_fetch_assoc($borrowerQuery); $userpassword = $user['password']; if($currentpassword!=$borrowerpassword) { echo "Invalid"; } else { $changepasswordSQL = "UPDATE user SET user.password='$newpassword' WHERE userID='$userID'"; $changepassword = mysqli_query($dbconnect, $changepasswordSQL); } } } ?>
true
baebcb9523bc7536939b80d05e59b7d5cc4705b5
PHP
marry92/books
/app/Http/Controllers/AuthorController.php
UTF-8
3,271
2.5625
3
[]
no_license
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Author; class AuthorController extends Controller { public function getShowData() { $authors = Author::orderBy('last_name')->orderBy('first_name')->with('books')->get(); return view('authors.show_data', compact('authors')); } public function postDatatables(Request $request) { $final = []; $final['results'] = []; $page = 1; if ($request->start >= 1) { $page = ($request->start / $request->length) + 1; } $request->merge(['page' => $page]); $builder = Author::query(); $records_total = clone($builder); $builder->withCount('books'); $authors = $builder->paginate($request->length); foreach($authors as $author) { $d = []; $d['name'] = $author->name; $d['age'] = $author->age; $d['address'] = $author->address; $d['books'] = $author->books_count; $d['actions'] = "<a href='/books/create?author_id=" . $author->id . "' class='btn btn-primary btn-sm' role='button'>Add book</a>"; $final['results'][] = $d; } $final['recordsTotal'] = $records_total->count(); $final['draw'] = $request->draw; $final['recordsFiltered'] = $authors->total(); return response()->json($final); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return view('authors.index'); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('authors.create'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $validator = \Validator::make($request->all(), Author::$validation_rules); if($validator->fails()) { return back()->withErrors($validator)->withInput(); } $author = new Author(); $author->fill($request->all()); $author->save(); return redirect('/authors'); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }
true
46b98e24090714928f2b76bc3b3b1b142b95d0a2
PHP
zxiao0216/ThinkPhp5
/application/api/controller/v1/Banner.php
UTF-8
1,001
2.5625
3
[ "Apache-2.0" ]
permissive
<?php /** * Created by PhpStorm. * User: eexiaox * Date: 2019/2/20 * Time: 14:31 */ namespace app\api\controller\v1; use app\api\validate\IDMustBePositiveInt; use app\api\model\Banner as BannerModel; use app\lib\exception\BannerMissException; use think\Exception; class Banner { /** * 获取制定id的Banner信息 * @url /banner/:id * @http GET * @id 指的是Banner的id号 */ public function getBanner($id){ // AOP 面向切面编程 (new IDMustBePositiveInt())->goCheck(); //模型查询静态方式 建议使用这种方式 $banner = BannerModel::find($id); //下边的方式是通过实例化的方式来定义模型 // $banner = new BannerModel(); // $banner = $banner->get($id); // $banner = BannerModel::getBannerByID($id); if(!$banner){ throw new BannerMissException(); // throw new Exception('内部错误'); } return json($banner); } }
true
939adc22e72acb2c233d6e6e62ab6237371a9459
PHP
PhamNgocLien/HackerRanks
/HackerRanks/Hospital.php
UTF-8
482
3.359375
3
[]
no_license
<?php function sum($arr) { $sum = 0; $exceptArr = array(); for ($i = 0; $i < count($arr); $i++) { for ($j = 0; $j < count($arr[$i]); $j++) { if ($arr[$i][$j] == 0) { array_push($exceptArr, $j); } else { if (!in_array($j, $exceptArr)) { $sum += $arr[$i][$j]; } } } } return $sum; } $result = sum([[0,1,2,0],[3,2,0,4],[7,8,1,2]]); echo $result;
true
bb1e06904737f837f2ae53e5b9968303f59c5b34
PHP
GuryanovaIrene/photos
/models/User.php
UTF-8
3,206
2.703125
3
[]
no_license
<?php namespace App; use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Events\Dispatcher; use Illuminate\Container\Container; class User extends MainModel { public $userID; public $userName; public $pwd; public $email; public $age; public $userDescribe; public function __construct($userID, $email, $pwd, $userName, $age, $userDescribe) { if ($userID > 0) { $this->userID = $userID; require "../core/capsule.php"; $data = Capsule::table('users') ->where('userID', '=', $userID) ->select(['email', 'userName', 'age', 'userDescribe', 'pwd']) ->get(); foreach ($data as $user) { $this->email = $user->email; $this->userName = $user->userName; $this->pwd = $user->pwd; $this->age = $user->age; $this->userDescribe = $user->userDescribe; } } else { $this->userID = ''; $this->email = $email; $this->userName = $userName; $this->pwd = $pwd; $this->age = $age; $this->userDescribe = $userDescribe; } } public function reg() { require "../core/capsule.php"; $data = Capsule::table('users') ->where('email', '=', $this->email) ->get(); if (isset($data->userID)) { $this->error[] = DOUBLE_USER; return null; } Capsule::table('users') ->insert(['userName' => $this->userName, 'email' => $this->email, 'pwd' => password_hash($this->pwd, PASSWORD_DEFAULT), 'age' => $this->age, 'userDescribe' => $this->userDescribe]); } public function auth() { require "../core/capsule.php"; $data = Capsule::table('users') ->where('email', '=', strtolower($this->email)) ->select(['userID', 'userName', 'age', 'userDescribe', 'pwd']) ->get(); if (empty($data)) { $this->error[] = WRONG_USER; return null; } foreach ($data as $user) { if (!password_verify($this->pwd, $user->pwd)) { $this->error[] = WRONG_PASSWORD; return null; } $this->userID = $user->userID; $this->userName = $user->userName; $this->age = $user->age; $this->userDescribe = $user->userDescribe; } } public function updateUser($userID, $userName, $age, $userDescribe) { require "../core/capsule.php"; Capsule::table('users') ->where('userID', '=', $userID) ->update(['userName' => $userName, 'age' => $age, 'userDescribe' => $userDescribe]); } public function allImages() { require "../core/capsule.php"; $data = Capsule::table('photos') ->where('userID', '=', $this->userID) ->select(['photoID', 'url']) ->get(); return $data; } }
true
428592e4aa804e6f6db0a6f1b80b4f1ff3f8861a
PHP
junzhengca/islp-canada
/app/Http/Controllers/JudgingResultController.php
UTF-8
3,303
2.5625
3
[ "Apache-2.0" ]
permissive
<?php /** * Copyright (c) 2018. Jun Zheng All Rights Reserved * I hereby grant the usage of this software to SOC (Statistical Society of Canada). * * Issue with the software? Contact juncapersonal at gmail dot com. */ namespace App\Http\Controllers; use App\Competition; use App\JudgingResult; use App\User; use Illuminate\Http\Request; /** * Class JudgingResultController * @package App\Http\Controllers */ class JudgingResultController extends Controller { /** * Get current competition (first competition with status !== archived) * @return Competition */ public function _getCurrentCompetition() { $competitions = Competition::all()->sortByDesc('created_at'); foreach ($competitions as $competition) { if ($competition->status !== 'archived') { return $competition; } } return null; } /** * Automatically assign judges * @param Request $request * @return \Illuminate\Http\RedirectResponse */ public function autoAssign(Request $request) { $judges = User::where('role', 2)->get(); $competition = $this->_getCurrentCompetition(); if (!$competition) { return back()->with('error', 'Invalid competition.'); } // Remove all previously assigned results foreach (JudgingResult::all() as $result) { if ($result->poster->competition_id === $competition->id) { $result->delete(); } } // Make sure you the count is valid if ($request->count > $judges || $request->count < 1 || !$competition) { return back()->with('error', 'Invalid input.'); } // Assign judges for ($i = 0; $i < $request->count * count($competition->posters); $i++) { $judge = $judges[$i % count($judges)]; $poster = $competition->posters[(int)(floor($i / $request->count))]; $result = new JudgingResult(); $result->poster_id = $poster->id; $result->user_id = $judge->id; $result->save(); } return back()->with('success', 'Judges assigned.'); } /** * Return confirm deletion page * @param Request $request * @param $id * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function deletePage(Request $request, $id) { $result = JudgingResult::find($id); if (!$result) { return response()->view('errors/404')->setStatusCode(404); } // Return the deletion page return view('portal/judging/delete', [ 'judging_result' => $result ]); } /** * Remove a judge from submission * @param Request $request * @param $id * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response */ public function delete(Request $request, $id) { $result = JudgingResult::find($id); if (!$result) { return response()->view('errors/404')->setStatusCode(404); } // Delete the result and return back to judging management page $result->delete(); return redirect('/portal/judging')->with('success', 'Judge removed.'); } }
true
212b94ce49a31c1146b9009a930f43ae66ade75a
PHP
RubsMaster/Proyecto-4to-cuatri
/register.php
UTF-8
9,578
2.71875
3
[]
no_license
<?php // Include config file require_once "config.php"; // Define variables and initialize with empty values $username = $password = $confirm_password = ""; $username_err = $password_err = $confirm_password_err = ""; // Processing form data when form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { // Validate username if (empty(trim($_POST["username"]))) { $username_err = "Please enter a username."; } else { // Prepare a select statement $sql = "SELECT id FROM users WHERE username = ?"; if ($stmt = $mysqli->prepare($sql)) { // Bind variables to the prepared statement as parameters $stmt->bind_param("s", $param_username); // Set parameters $param_username = trim($_POST["username"]); // Attempt to execute the prepared statement if ($stmt->execute()) { // store result $stmt->store_result(); if ($stmt->num_rows == 1) { $username_err = "This username is already taken."; } else { $username = trim($_POST["username"]); } } else { echo "Oops! Something went wrong. Please try again later."; } // Close statement $stmt->close(); } } // Validate password if (empty(trim($_POST["password"]))) { $password_err = "Please enter a password."; } elseif (strlen(trim($_POST["password"])) < 6) { $password_err = "Password must have atleast 6 characters."; } else { $password = trim($_POST["password"]); } // Validate confirm password if (empty(trim($_POST["confirm_password"]))) { $confirm_password_err = "Please confirm password."; } else { $confirm_password = trim($_POST["confirm_password"]); if (empty($password_err) && ($password != $confirm_password)) { $confirm_password_err = "Password did not match."; } } // Check input errors before inserting in database if (empty($username_err) && empty($password_err) && empty($confirm_password_err)) { // Prepare an insert statement $sql = "INSERT INTO users (username, contra) VALUES (?, ?)"; if ($stmt = $mysqli->prepare($sql)) { // Bind variables to the prepared statement as parameters $stmt->bind_param("ss", $param_username, $param_password); // Set parameters $param_username = $username; $param_password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash // Attempt to execute the prepared statement if ($stmt->execute()) { // Redirect to login page header("location: index.php"); } else { echo "Something went wrong. Please try again later."; } // Close statement $stmt->close(); } } // Close connection $mysqli->close(); } ?> <!DOCTYPE html> <!-- ============================== Project: Metronic "Asentus" Frontend Freebie - Responsive HTML Template Based On Twitter Bootstrap 3.3.4 Version: 1.0 Author: KeenThemes Primary use: Corporate, Business Themes. Email: support@keenthemes.com Follow: http://www.twitter.com/keenthemes Like: http://www.facebook.com/keenthemes Website: http://www.keenthemes.com Premium: Premium Metronic Admin Theme: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes ================================== --> <html lang="en" class="no-js"> <!-- BEGIN HEAD --> <head> <meta charset="utf-8" /> <title>Inicio | STC</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="width=device-width, initial-scale=1" name="viewport" /> <meta content="" name="description" /> <meta content="" name="author" /> <!-- GLOBAL MANDATORY STYLES --> <link href="http://fonts.googleapis.com/css?family=Hind:300,400,500,600,700" rel="stylesheet" type="text/css"> <link href="vendor/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" /> <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- PAGE LEVEL PLUGIN STYLES --> <link href="css/animate.css" rel="stylesheet"> <link href="vendor/swiper/css/swiper.min.css" rel="stylesheet" type="text/css" /> <!-- THEME STYLES --> <link href="css/layout.min.css" rel="stylesheet" type="text/css" /> <!-- Favicon --> <link rel="shortcut icon" href="favicon.ico" /> </head> <!-- END HEAD --> <!-- BODY --> <body> <header class="header navbar-fixed-top"> <?php if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){ include('includes/headerLoged.php'); } else{ include('includes/header.php'); } ?> </header> <!--========== PARALLAX ==========--> <div class="parallax-window" data-parallax="scroll" data-image-src="img/1920x1080/07.jpeg"> <div class="parallax-content container"> <h1 class="carousel-title">Noticias tecnologicas</h1> <p>Apartado específico para colocar las noticias de tecnología en general más relevantes o interesantes. <br /> También se muestran contenido del equipo de soporte de STC para brindar información oficial.</p> </div> </div> <!--========== PARALLAX ==========--> <!--========== PAGE LAYOUT ==========--> <!-- Service --> <div class="d-flex align-items-center main-container" style="padding-bottom: 20px; padding-top: 20px;"> <div class="container d-flex justify-content-center"> <div class="card p-4 text-center" style="min-width: 400px"> <h2>Registro</h2> <p>Llena este formulario para registrarte</p> <!-- == FORM == --> <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post"> <div class="form-group <?php echo (!empty($username_err)) ? 'has-error' : ''; ?>"> <label>Nombre de usuario</label> <input type="text" name="username" class="form-control" value="<?php echo $username; ?>"> <span class="help-block"><?php echo $username_err; ?></span> </div> <div class="form-group <?php echo (!empty($password_err)) ? 'has-error' : ''; ?>"> <label>Contraseña</label> <input type="password" name="password" class="form-control"> <span class="help-block"><?php echo $password_err; ?></span> </div> <div class="form-group <?php echo (!empty($confirm_password_err)) ? 'has-error' : ''; ?>"> <label>Confirmar contraseña</label> <input type="password" name="confirm_password" class="form-control" value="<?php echo $confirm_password; ?>"> <span class="help-block"><?php echo $confirm_password_err; ?></span> </div> <div class="form-group"> <input type="submit" class="btn btn-primary" value="Enviar"> <input type="reset" class="btn btn-default" value="Restablecer"> </div> <p>¿Ya tienes una cuenta? <a href="login.php">Iniciar sesión</a>.</p> </form> <!-- == FORM == --> </div> </div> </div> <!-- End Service --> <!--========== END PAGE LAYOUT ==========--> <!--========== FOOTER ==========--> <footer> <?php include('includes/footer.php') ?> </footer> <!--========== END FOOTER ==========--> <!-- Back To Top --> <a href="javascript:void(0);" class="js-back-to-top back-to-top">↑</a> <!-- JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) --> <!-- CORE PLUGINS --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/jquery-migrate.min.js" type="text/javascript"></script> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!-- PAGE LEVEL PLUGINS --> <script src="vendor/jquery.easing.js" type="text/javascript"></script> <script src="vendor/jquery.back-to-top.js" type="text/javascript"></script> <script src="vendor/jquery.smooth-scroll.js" type="text/javascript"></script> <script src="vendor/jquery.wow.min.js" type="text/javascript"></script> <script src="vendor/jquery.parallax.min.js" type="text/javascript"></script> <script src="vendor/swiper/js/swiper.jquery.min.js" type="text/javascript"></script> <script src="js/layout.min.js" type="text/javascript"></script> <script src="js/components/wow.min.js" type="text/javascript"></script> <script src="js/components/swiper.min.js" type="text/javascript"></script> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG" crossorigin="anonymous"></script> </body> <!-- END BODY --> </html>
true
a75cebd6fba5368b56d96b24695c61cbd18c176a
PHP
vrann/varhound
/Indexer/Finder.php
UTF-8
986
3.015625
3
[]
no_license
<?php /** * @author Extensibility DL-X-Extensibility-Team@corp.ebay.com */ class Finder { /** * @param string $path * @return array */ public function getAllFiles($path) { $fileList = []; return $this->findPhpFiles($path, $fileList); } /** * @param string $path * @param array $fileList * @return array */ private function findPhpFiles($path, &$fileList) { $directoryIterator = new DirectoryIterator($path); /** @var SplFileInfo $fileInfo */ foreach ($directoryIterator as $fileInfo) { if ($fileInfo->isDot()) { continue; } if ($fileInfo->isDir()) { $this->findPhpFiles($path . '/' . $fileInfo->getFileName(), $fileList); } elseif (preg_match('/[A-Z]{1,}[a-zA-Z]+\.php/', $fileInfo->getFileName())) { $fileList[] = $path . '/' . $fileInfo->getFileName(); } } return $fileList; } }
true
64f7ff7d07c2ae5adce2c2795e30ed0c380de8b2
PHP
datdep97/My-SOLID
/baitapsolid.php
UTF-8
1,299
3.75
4
[]
no_license
<?php class AreaCalculate { public function calculate(AreaInterface $shape) { $shapenumber = 10; $totalArea = $shapenumber * $shape->calculateArea(); return $totalArea; } } interface AreaInterface { public function calculateArea(); } class Rectangle implements AreaInterface { public $width; public $height; public function __construct($width, $height) { $this->width = $width; $this->height = $height; } public function calculateArea(){ $area = $this->height * $this->width; return $area; } } class Circle implements AreaInterface { public $radius; public function __construct($radius) { $this->radius = $radius; } public function calculateArea(){ $area = $this->radius * $this->radius * pi(); return $area; } } /*class Triangular implements AreaInterface { public $height; public $base; public function __construct($height, $base) { $this->height = $height; $this->base = $base; } public function calculateArea(){ $area = $this->height * $this->base / 2; return $area; } }*/ $triangular = new Triangular(5, 2); $run = new AreaCalculate(); echo $run -> calculate($triangular); ?>
true
8dadf105b3527ceb852543a75ee8ff745acb45c4
PHP
koansu-php/core
/Map.php
UTF-8
5,976
3.28125
3
[]
no_license
<?php /** * * Created by mtils on 17.12.17 at 10:56. **/ namespace Koansu\Core; use Closure; use function array_key_exists; use function array_pop; use function call_user_func; use function explode; use function is_array; use function preg_quote; use function preg_split; use function strlen; use function substr; class Map { /** * Return true if $check returns true on ALL items. * * @param iterable $items * @param callable $check * * @return bool */ public static function all(iterable $items, callable $check) : bool { foreach ($items as $item) { if (!call_user_func($check, $item)) { return false; } } // Return false if array is empty return isset($item); } /** * Return true if $check returns true on ANY item. * * @param iterable $items * @param callable $check * * @return bool */ public static function any(iterable $items, callable $check) : bool { foreach ($items as $item) { if (call_user_func($check, $item)) { return true; } } return false; } /** * Combine all passed callables to one callable that will call them all. * The returned closure will return all results in an array. * * @param ...$callables * @return Closure */ public static function combine(...$callables) : Closure { return function (...$args) use ($callables) { $results = []; foreach ($callables as $callable) { $results[] = $callable(...$args); } return $results; }; } /** * Get a key from a nested array. Query a deeply nested array with * property.child.name. * * @param array $nested * @param string $key * @param string $delimiter * * @return mixed **/ public static function get(array $nested, string $key, string $delimiter = '.') { if ($key == '*') { return $nested; } if ($key == $delimiter) { return self::withoutNested($nested); } $delimiterLength = 0-strlen($delimiter); if($endsWithDelimiter = (substr($key, $delimiterLength) === $delimiter)) { $key = substr($key, 0, $delimiterLength); } if (isset($nested[$key])) { return $endsWithDelimiter ? self::withoutNested($nested[$key]) : $nested[$key]; } foreach (explode($delimiter, $key) as $segment) { if (!is_array($nested) || !array_key_exists($segment, $nested)) { return null; } $nested = $nested[$segment]; } return $endsWithDelimiter ? self::withoutNested($nested) : $nested; } /** * Put a flat array in this method, and it will return a recursively nested * version. Separate the segments by $delimiter * * @param array $flat * @param string $delimiter * * @return array **/ public static function nest(array $flat, string $delimiter = '.') : array { $tree = []; foreach ($flat as $key => $val) { // Get parent parts and the current leaf $parts = self::splitPath($key, $delimiter); $leafPart = array_pop($parts); // Build parent structure $parent = &$tree; foreach ($parts as $part) { if (!isset($parent[$part])) { $parent[$part] = []; } elseif (!is_array($parent[$part])) { $parent[$part] = []; } $parent = &$parent[$part]; } // Add the final part to the structure if (empty($parent[$leafPart])) { $parent[$leafPart] = $val; } } return $tree; } /** * Converts a nested array to a flat one. * * @param array $nested The nested source array * @param string $delimiter Levels connector * * @return array **/ public static function flatten(array $nested, string $delimiter = '.') : array { $result = []; static::flattenArray($result, $nested, $delimiter); return $result; } /** * Splits the path into an array. * * @param string $path * @param string $separator (default:.) * * @return array **/ public static function splitPath(string $path, string $separator = '.') : array { $regex = '/(?<=\w)('.preg_quote($separator, '/').')(?=\w)/'; return preg_split($regex, $path, -1);//, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); } /** * Recursively converts nested array into a flat one with keys preserving. * * @param array $result Resulting array * @param array $array Source array * @param string $delimiter Levels connector * @param ?string $prefix Key's prefix **/ protected static function flattenArray(array &$result, array $array, string $delimiter = '.', string $prefix = null) { foreach ($array as $key => $value) { if (!is_array($value) || isset($value[0])) { $result[$prefix.$key] = $value; continue; } self::flattenArray($result, $value, $delimiter, $prefix.$key.$delimiter); } } /** * @param array $array * @return array */ protected static function withoutNested(array $array) : array { $filtered = []; foreach ($array as $key=>$value) { if (!is_array($value)) { $filtered[$key] = $value; continue; } if (isset($value[0])) { $filtered[$key] = $value; } } return $filtered; } }
true
c9573c317b3780da2c87880764c9ae60bb9dab80
PHP
arima-ryunosuke/phpunit-extension
/inc/annotation.php
UTF-8
54,835
2.53125
3
[ "MIT" ]
permissive
<?php namespace ryunosuke\PHPUnit; /** * @see \ryunosuke\PHPUnit\Constraint\ClosesTo * @method \ryunosuke\PHPUnit\Actual eachClosesTo($value, ?float $delta = null) * @method \ryunosuke\PHPUnit\Actual closesTo($value, ?float $delta = null) * @method \ryunosuke\PHPUnit\Actual notClosesTo($value, ?float $delta = null) * @method \ryunosuke\PHPUnit\Actual closesToAny(array $values, ?float $delta = null) * @method \ryunosuke\PHPUnit\Actual closesToAll(array $values, ?float $delta = null) * @method \ryunosuke\PHPUnit\Actual notClosesToAny(array $values, ?float $delta = null) * @method \ryunosuke\PHPUnit\Actual notClosesToAll(array $values, ?float $delta = null) * * @see \ryunosuke\PHPUnit\Constraint\Contains * @method \ryunosuke\PHPUnit\Actual eachContains($needle, ?bool $strict = null) * @method \ryunosuke\PHPUnit\Actual contains($needle, ?bool $strict = null) * @method \ryunosuke\PHPUnit\Actual notContains($needle, ?bool $strict = null) * @method \ryunosuke\PHPUnit\Actual containsAny(array $needles, ?bool $strict = null) * @method \ryunosuke\PHPUnit\Actual containsAll(array $needles, ?bool $strict = null) * @method \ryunosuke\PHPUnit\Actual notContainsAny(array $needles, ?bool $strict = null) * @method \ryunosuke\PHPUnit\Actual notContainsAll(array $needles, ?bool $strict = null) * * @see \ryunosuke\PHPUnit\Constraint\DatetimeEquals * @method \ryunosuke\PHPUnit\Actual eachDatetimeEquals($expected, $delta = 0.0) * @method \ryunosuke\PHPUnit\Actual datetimeEquals($expected, $delta = 0.0) * @method \ryunosuke\PHPUnit\Actual datetimeNotEquals($expected, $delta = 0.0) * @method \ryunosuke\PHPUnit\Actual datetimeEqualsAny(array $expecteds, $delta = 0.0) * @method \ryunosuke\PHPUnit\Actual datetimeEqualsAll(array $expecteds, $delta = 0.0) * @method \ryunosuke\PHPUnit\Actual datetimeNotEqualsAny(array $expecteds, $delta = 0.0) * @method \ryunosuke\PHPUnit\Actual datetimeNotEqualsAll(array $expecteds, $delta = 0.0) * * @see \ryunosuke\PHPUnit\Constraint\EqualsFile * @method \ryunosuke\PHPUnit\Actual eachEqualsFile($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsFile($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsFile($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsFileAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsFileAll(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsFileAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsFileAll(array $values, bool $ignoreCase = false) * * @see \ryunosuke\PHPUnit\Constraint\EqualsIgnoreWS * @method \ryunosuke\PHPUnit\Actual eachEqualsIgnoreWS($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsIgnoreWS($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsIgnoreWS($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsIgnoreWSAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsIgnoreWSAll(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsIgnoreWSAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsIgnoreWSAll(array $values, bool $ignoreCase = false) * * @see \ryunosuke\PHPUnit\Constraint\EqualsPath * @method \ryunosuke\PHPUnit\Actual eachEqualsPath($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsPath($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsPath($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsPathAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsPathAll(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsPathAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsPathAll(array $values, bool $ignoreCase = false) * * @see \ryunosuke\PHPUnit\Constraint\FileContains * @method \ryunosuke\PHPUnit\Actual eachFileContains($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileContains($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileNotContains($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileContainsAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileContainsAll(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileNotContainsAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileNotContainsAll(array $values, bool $ignoreCase = false) * * @see \ryunosuke\PHPUnit\Constraint\FileEquals * @method \ryunosuke\PHPUnit\Actual eachFileEquals($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileEquals($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileNotEquals($value, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileEqualsAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileEqualsAll(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileNotEqualsAny(array $values, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual fileNotEqualsAll(array $values, bool $ignoreCase = false) * * @see \ryunosuke\PHPUnit\Constraint\FileSizeIs * @method \ryunosuke\PHPUnit\Actual eachFileSizeIs(int $size) * @method \ryunosuke\PHPUnit\Actual fileSizeIs(int $size) * @method \ryunosuke\PHPUnit\Actual fileSizeIsNot(int $size) * @method \ryunosuke\PHPUnit\Actual fileSizeIsAny(array $sizes) * @method \ryunosuke\PHPUnit\Actual fileSizeIsAll(array $sizes) * @method \ryunosuke\PHPUnit\Actual fileSizeIsNotAny(array $sizes) * @method \ryunosuke\PHPUnit\Actual fileSizeIsNotAll(array $sizes) * * @see \ryunosuke\PHPUnit\Constraint\HasKey * @method \ryunosuke\PHPUnit\Actual eachHasKey($key) * @method \ryunosuke\PHPUnit\Actual hasKey($key) * @method \ryunosuke\PHPUnit\Actual notHasKey($key) * @method \ryunosuke\PHPUnit\Actual hasKeyAny(array $keys) * @method \ryunosuke\PHPUnit\Actual hasKeyAll(array $keys) * @method \ryunosuke\PHPUnit\Actual notHasKeyAny(array $keys) * @method \ryunosuke\PHPUnit\Actual notHasKeyAll(array $keys) * * @see \ryunosuke\PHPUnit\Constraint\HtmlMatchesArray * @method \ryunosuke\PHPUnit\Actual eachHtmlMatchesArray($nodes) * @method \ryunosuke\PHPUnit\Actual htmlMatchesArray($nodes) * @method \ryunosuke\PHPUnit\Actual htmlNotMatchesArray($nodes) * @method \ryunosuke\PHPUnit\Actual htmlMatchesArrayAny(array $nodess) * @method \ryunosuke\PHPUnit\Actual htmlMatchesArrayAll(array $nodess) * @method \ryunosuke\PHPUnit\Actual htmlNotMatchesArrayAny(array $nodess) * @method \ryunosuke\PHPUnit\Actual htmlNotMatchesArrayAll(array $nodess) * * @see \ryunosuke\PHPUnit\Constraint\InTime * @method \ryunosuke\PHPUnit\Actual eachInTime(float $time) * @method \ryunosuke\PHPUnit\Actual inTime(float $time) * @method \ryunosuke\PHPUnit\Actual notInTime(float $time) * @method \ryunosuke\PHPUnit\Actual inTimeAny(array $times) * @method \ryunosuke\PHPUnit\Actual inTimeAll(array $times) * @method \ryunosuke\PHPUnit\Actual notInTimeAny(array $times) * @method \ryunosuke\PHPUnit\Actual notInTimeAll(array $times) * * @see \ryunosuke\PHPUnit\Constraint\Is * @method \ryunosuke\PHPUnit\Actual eachIs($value, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual is($value, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isNot($value, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isAny(array $values, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isAll(array $values, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isNotAny(array $values, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isNotAll(array $values, ?float $delta = null, bool $canonicalize = false, bool $ignoreCase = false) * * @see \ryunosuke\PHPUnit\Constraint\IsBetween * @method \ryunosuke\PHPUnit\Actual eachIsBetween($min, $max) * @method \ryunosuke\PHPUnit\Actual isBetween($min, $max) * @method \ryunosuke\PHPUnit\Actual isNotBetween($min, $max) * @method \ryunosuke\PHPUnit\Actual isBetweenAny(array $minmaxs) * @method \ryunosuke\PHPUnit\Actual isBetweenAll(array $minmaxs) * @method \ryunosuke\PHPUnit\Actual isNotBetweenAny(array $minmaxs) * @method \ryunosuke\PHPUnit\Actual isNotBetweenAll(array $minmaxs) * * @see \ryunosuke\PHPUnit\Constraint\IsBlank * @method \ryunosuke\PHPUnit\Actual eachIsBlank(bool $trim = true) * @method \ryunosuke\PHPUnit\Actual isBlank(bool $trim = true) * @method \ryunosuke\PHPUnit\Actual isNotBlank(bool $trim = true) * * @see \ryunosuke\PHPUnit\Constraint\IsCType * @method \ryunosuke\PHPUnit\Actual eachIsCType(string $type) * @method \ryunosuke\PHPUnit\Actual isCType(string $type) * @method \ryunosuke\PHPUnit\Actual isNotCType(string $type) * @method \ryunosuke\PHPUnit\Actual isCTypeAny(array $types) * @method \ryunosuke\PHPUnit\Actual isCTypeAll(array $types) * @method \ryunosuke\PHPUnit\Actual isNotCTypeAny(array $types) * @method \ryunosuke\PHPUnit\Actual isNotCTypeAll(array $types) * * @see \ryunosuke\PHPUnit\Constraint\IsFalsy * @method \ryunosuke\PHPUnit\Actual eachIsFalsy() * @method \ryunosuke\PHPUnit\Actual isFalsy() * @method \ryunosuke\PHPUnit\Actual isNotFalsy() * * @see \ryunosuke\PHPUnit\Constraint\IsThrowable * @method \ryunosuke\PHPUnit\Actual eachIsThrowable($expected = null) * @method \ryunosuke\PHPUnit\Actual isThrowable($expected = null) * @method \ryunosuke\PHPUnit\Actual isNotThrowable($expected = null) * * @see \ryunosuke\PHPUnit\Constraint\IsTruthy * @method \ryunosuke\PHPUnit\Actual eachIsTruthy() * @method \ryunosuke\PHPUnit\Actual isTruthy() * @method \ryunosuke\PHPUnit\Actual isNotTruthy() * * @see \ryunosuke\PHPUnit\Constraint\IsValid * @method \ryunosuke\PHPUnit\Actual eachIsValid(string $type, $flags = 0) * @method \ryunosuke\PHPUnit\Actual isValid(string $type, $flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValid(string $type, $flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidAny(array $types, $flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidAll(array $types, $flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidAny(array $types, $flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidAll(array $types, $flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\JsonMatchesArray * @method \ryunosuke\PHPUnit\Actual eachJsonMatchesArray(array $expected, bool $subset = false) * @method \ryunosuke\PHPUnit\Actual jsonMatchesArray(array $expected, bool $subset = false) * @method \ryunosuke\PHPUnit\Actual jsonNotMatchesArray(array $expected, bool $subset = false) * @method \ryunosuke\PHPUnit\Actual jsonMatchesArrayAny(array $expecteds, bool $subset = false) * @method \ryunosuke\PHPUnit\Actual jsonMatchesArrayAll(array $expecteds, bool $subset = false) * @method \ryunosuke\PHPUnit\Actual jsonNotMatchesArrayAny(array $expecteds, bool $subset = false) * @method \ryunosuke\PHPUnit\Actual jsonNotMatchesArrayAll(array $expecteds, bool $subset = false) * * @see \ryunosuke\PHPUnit\Constraint\LengthEquals * @method \ryunosuke\PHPUnit\Actual eachLengthEquals(int $length) * @method \ryunosuke\PHPUnit\Actual lengthEquals(int $length) * @method \ryunosuke\PHPUnit\Actual lengthNotEquals(int $length) * @method \ryunosuke\PHPUnit\Actual lengthEqualsAny(array $lengths) * @method \ryunosuke\PHPUnit\Actual lengthEqualsAll(array $lengths) * @method \ryunosuke\PHPUnit\Actual lengthNotEqualsAny(array $lengths) * @method \ryunosuke\PHPUnit\Actual lengthNotEqualsAll(array $lengths) * * @see \ryunosuke\PHPUnit\Constraint\MatchesCountEquals * @method \ryunosuke\PHPUnit\Actual eachMatchesCountEquals(array $patternCounts) * @method \ryunosuke\PHPUnit\Actual matchesCountEquals(array $patternCounts) * @method \ryunosuke\PHPUnit\Actual notMatchesCountNotEquals(array $patternCounts) * @method \ryunosuke\PHPUnit\Actual matchesCountEqualsAny(array $patternCountss) * @method \ryunosuke\PHPUnit\Actual matchesCountEqualsAll(array $patternCountss) * @method \ryunosuke\PHPUnit\Actual notMatchesCountNotEqualsAny(array $patternCountss) * @method \ryunosuke\PHPUnit\Actual notMatchesCountNotEqualsAll(array $patternCountss) * * @see \ryunosuke\PHPUnit\Constraint\OutputMatches * @method \ryunosuke\PHPUnit\Actual eachOutputMatches($value, $raw = false, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputMatches($value, $raw = false, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputNotMatches($value, $raw = false, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputMatchesAny(array $values, $raw = false, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputMatchesAll(array $values, $raw = false, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputNotMatchesAny(array $values, $raw = false, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputNotMatchesAll(array $values, $raw = false, $with = ["", ""]) * * @see \ryunosuke\PHPUnit\Constraint\StringLengthEquals * @method \ryunosuke\PHPUnit\Actual eachStringLengthEquals(int $length, bool $multibyte = false) * @method \ryunosuke\PHPUnit\Actual stringLengthEquals(int $length, bool $multibyte = false) * @method \ryunosuke\PHPUnit\Actual stringLengthNotEquals(int $length, bool $multibyte = false) * @method \ryunosuke\PHPUnit\Actual stringLengthEqualsAny(array $lengths, bool $multibyte = false) * @method \ryunosuke\PHPUnit\Actual stringLengthEqualsAll(array $lengths, bool $multibyte = false) * @method \ryunosuke\PHPUnit\Actual stringLengthNotEqualsAny(array $lengths, bool $multibyte = false) * @method \ryunosuke\PHPUnit\Actual stringLengthNotEqualsAll(array $lengths, bool $multibyte = false) * * @see \ryunosuke\PHPUnit\Constraint\SubsetEquals * @method \ryunosuke\PHPUnit\Actual eachSubsetEquals($subset, bool $canonicalize = false) * @method \ryunosuke\PHPUnit\Actual subsetEquals($subset, bool $canonicalize = false) * @method \ryunosuke\PHPUnit\Actual subsetNotEquals($subset, bool $canonicalize = false) * @method \ryunosuke\PHPUnit\Actual subsetEqualsAny(array $subsets, bool $canonicalize = false) * @method \ryunosuke\PHPUnit\Actual subsetEqualsAll(array $subsets, bool $canonicalize = false) * @method \ryunosuke\PHPUnit\Actual subsetNotEqualsAny(array $subsets, bool $canonicalize = false) * @method \ryunosuke\PHPUnit\Actual subsetNotEqualsAll(array $subsets, bool $canonicalize = false) * * @see \ryunosuke\PHPUnit\Constraint\SubsetMatches * @method \ryunosuke\PHPUnit\Actual eachSubsetMatches(array $subpatterns) * @method \ryunosuke\PHPUnit\Actual subsetMatches(array $subpatterns) * @method \ryunosuke\PHPUnit\Actual subsetNotMatches(array $subpatterns) * @method \ryunosuke\PHPUnit\Actual subsetMatchesAny(array $subpatternss) * @method \ryunosuke\PHPUnit\Actual subsetMatchesAll(array $subpatternss) * @method \ryunosuke\PHPUnit\Actual subsetNotMatchesAny(array $subpatternss) * @method \ryunosuke\PHPUnit\Actual subsetNotMatchesAll(array $subpatternss) * * @see \ryunosuke\PHPUnit\Constraint\Throws * @method \ryunosuke\PHPUnit\Actual eachThrows($expected = null) * @method \ryunosuke\PHPUnit\Actual throws($expected = null) * @method \ryunosuke\PHPUnit\Actual notThrows($expected = null) * * @see \PHPUnit\Framework\Constraint\IsFalse * @method \ryunosuke\PHPUnit\Actual eachIsFalse() * @method \ryunosuke\PHPUnit\Actual isFalse() * @method \ryunosuke\PHPUnit\Actual isNotFalse() * * @see \PHPUnit\Framework\Constraint\IsTrue * @method \ryunosuke\PHPUnit\Actual eachIsTrue() * @method \ryunosuke\PHPUnit\Actual isTrue() * @method \ryunosuke\PHPUnit\Actual isNotTrue() * * @see \PHPUnit\Framework\Constraint\Callback * @method \ryunosuke\PHPUnit\Actual eachCallback(callable $callback) * @method \ryunosuke\PHPUnit\Actual callback(callable $callback) * @method \ryunosuke\PHPUnit\Actual notCallback(callable $callback) * @method \ryunosuke\PHPUnit\Actual callbackAny(array $callbacks) * @method \ryunosuke\PHPUnit\Actual callbackAll(array $callbacks) * @method \ryunosuke\PHPUnit\Actual notCallbackAny(array $callbacks) * @method \ryunosuke\PHPUnit\Actual notCallbackAll(array $callbacks) * * @see \PHPUnit\Framework\Constraint\Count * @method \ryunosuke\PHPUnit\Actual eachCount(int $expected) * @method \ryunosuke\PHPUnit\Actual count(int $expected) * @method \ryunosuke\PHPUnit\Actual notCount(int $expected) * @method \ryunosuke\PHPUnit\Actual countAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual countAll(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notCountAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notCountAll(array $expecteds) * * @see \PHPUnit\Framework\Constraint\GreaterThan * @method \ryunosuke\PHPUnit\Actual eachGreaterThan($value) * @method \ryunosuke\PHPUnit\Actual greaterThan($value) * @method \ryunosuke\PHPUnit\Actual notGreaterThan($value) * @method \ryunosuke\PHPUnit\Actual greaterThanAny(array $values) * @method \ryunosuke\PHPUnit\Actual greaterThanAll(array $values) * @method \ryunosuke\PHPUnit\Actual notGreaterThanAny(array $values) * @method \ryunosuke\PHPUnit\Actual notGreaterThanAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsEmpty * @method \ryunosuke\PHPUnit\Actual eachIsEmpty() * @method \ryunosuke\PHPUnit\Actual isEmpty() * @method \ryunosuke\PHPUnit\Actual isNotEmpty() * * @see \PHPUnit\Framework\Constraint\LessThan * @method \ryunosuke\PHPUnit\Actual eachLessThan($value) * @method \ryunosuke\PHPUnit\Actual lessThan($value) * @method \ryunosuke\PHPUnit\Actual notLessThan($value) * @method \ryunosuke\PHPUnit\Actual lessThanAny(array $values) * @method \ryunosuke\PHPUnit\Actual lessThanAll(array $values) * @method \ryunosuke\PHPUnit\Actual notLessThanAny(array $values) * @method \ryunosuke\PHPUnit\Actual notLessThanAll(array $values) * * @see \PHPUnit\Framework\Constraint\SameSize * @method \ryunosuke\PHPUnit\Actual eachSameSize(iterable $expected) * @method \ryunosuke\PHPUnit\Actual sameSize(iterable $expected) * @method \ryunosuke\PHPUnit\Actual notSameSize(iterable $expected) * @method \ryunosuke\PHPUnit\Actual sameSizeAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual sameSizeAll(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notSameSizeAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notSameSizeAll(array $expecteds) * * @see \PHPUnit\Framework\Constraint\IsEqual * @method \ryunosuke\PHPUnit\Actual eachIsEqual($value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isEqual($value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isNotEqual($value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isEqualAny(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isEqualAll(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isNotEqualAny(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual isNotEqualAll(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) * * @see \PHPUnit\Framework\Constraint\IsEqualCanonicalizing * @method \ryunosuke\PHPUnit\Actual eachIsEqualCanonicalizing($value) * @method \ryunosuke\PHPUnit\Actual isEqualCanonicalizing($value) * @method \ryunosuke\PHPUnit\Actual isNotEqualCanonicalizing($value) * @method \ryunosuke\PHPUnit\Actual isEqualCanonicalizingAny(array $values) * @method \ryunosuke\PHPUnit\Actual isEqualCanonicalizingAll(array $values) * @method \ryunosuke\PHPUnit\Actual isNotEqualCanonicalizingAny(array $values) * @method \ryunosuke\PHPUnit\Actual isNotEqualCanonicalizingAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsEqualIgnoringCase * @method \ryunosuke\PHPUnit\Actual eachIsEqualIgnoringCase($value) * @method \ryunosuke\PHPUnit\Actual isEqualIgnoringCase($value) * @method \ryunosuke\PHPUnit\Actual isNotEqualIgnoringCase($value) * @method \ryunosuke\PHPUnit\Actual isEqualIgnoringCaseAny(array $values) * @method \ryunosuke\PHPUnit\Actual isEqualIgnoringCaseAll(array $values) * @method \ryunosuke\PHPUnit\Actual isNotEqualIgnoringCaseAny(array $values) * @method \ryunosuke\PHPUnit\Actual isNotEqualIgnoringCaseAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsEqualWithDelta * @method \ryunosuke\PHPUnit\Actual eachIsEqualWithDelta($value, float $delta) * @method \ryunosuke\PHPUnit\Actual isEqualWithDelta($value, float $delta) * @method \ryunosuke\PHPUnit\Actual isNotEqualWithDelta($value, float $delta) * @method \ryunosuke\PHPUnit\Actual isEqualWithDeltaAny(array $valuedeltas) * @method \ryunosuke\PHPUnit\Actual isEqualWithDeltaAll(array $valuedeltas) * @method \ryunosuke\PHPUnit\Actual isNotEqualWithDeltaAny(array $valuedeltas) * @method \ryunosuke\PHPUnit\Actual isNotEqualWithDeltaAll(array $valuedeltas) * * @see \PHPUnit\Framework\Constraint\Exception * @method \ryunosuke\PHPUnit\Actual eachException(string $className) * @method \ryunosuke\PHPUnit\Actual exception(string $className) * @method \ryunosuke\PHPUnit\Actual notException(string $className) * @method \ryunosuke\PHPUnit\Actual exceptionAny(array $classNames) * @method \ryunosuke\PHPUnit\Actual exceptionAll(array $classNames) * @method \ryunosuke\PHPUnit\Actual notExceptionAny(array $classNames) * @method \ryunosuke\PHPUnit\Actual notExceptionAll(array $classNames) * * @see \PHPUnit\Framework\Constraint\ExceptionCode * @method \ryunosuke\PHPUnit\Actual eachExceptionCode($expected) * @method \ryunosuke\PHPUnit\Actual exceptionCode($expected) * @method \ryunosuke\PHPUnit\Actual notExceptionCode($expected) * @method \ryunosuke\PHPUnit\Actual exceptionCodeAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual exceptionCodeAll(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notExceptionCodeAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notExceptionCodeAll(array $expecteds) * * @see \PHPUnit\Framework\Constraint\ExceptionMessage * @method \ryunosuke\PHPUnit\Actual eachExceptionMessage(string $expected) * @method \ryunosuke\PHPUnit\Actual exceptionMessage(string $expected) * @method \ryunosuke\PHPUnit\Actual notExceptionMessage(string $expected) * @method \ryunosuke\PHPUnit\Actual exceptionMessageAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual exceptionMessageAll(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notExceptionMessageAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notExceptionMessageAll(array $expecteds) * * @see \PHPUnit\Framework\Constraint\ExceptionMessageRegularExpression * @method \ryunosuke\PHPUnit\Actual eachExceptionMessageRegularExpression(string $expected) * @method \ryunosuke\PHPUnit\Actual exceptionMessageRegularExpression(string $expected) * @method \ryunosuke\PHPUnit\Actual notExceptionMessageRegularExpression(string $expected) * @method \ryunosuke\PHPUnit\Actual exceptionMessageRegularExpressionAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual exceptionMessageRegularExpressionAll(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notExceptionMessageRegularExpressionAny(array $expecteds) * @method \ryunosuke\PHPUnit\Actual notExceptionMessageRegularExpressionAll(array $expecteds) * * @see \PHPUnit\Framework\Constraint\DirectoryExists * @method \ryunosuke\PHPUnit\Actual eachDirectoryExists() * @method \ryunosuke\PHPUnit\Actual directoryExists() * @method \ryunosuke\PHPUnit\Actual directoryNotExists() * * @see \PHPUnit\Framework\Constraint\FileExists * @method \ryunosuke\PHPUnit\Actual eachFileExists() * @method \ryunosuke\PHPUnit\Actual fileExists() * @method \ryunosuke\PHPUnit\Actual fileNotExists() * * @see \PHPUnit\Framework\Constraint\IsReadable * @method \ryunosuke\PHPUnit\Actual eachIsReadable() * @method \ryunosuke\PHPUnit\Actual isReadable() * @method \ryunosuke\PHPUnit\Actual isNotReadable() * * @see \PHPUnit\Framework\Constraint\IsWritable * @method \ryunosuke\PHPUnit\Actual eachIsWritable() * @method \ryunosuke\PHPUnit\Actual isWritable() * @method \ryunosuke\PHPUnit\Actual isNotWritable() * * @see \PHPUnit\Framework\Constraint\IsAnything * @method \ryunosuke\PHPUnit\Actual eachIsAnything() * @method \ryunosuke\PHPUnit\Actual isAnything() * @method \ryunosuke\PHPUnit\Actual isNotAnything() * * @see \PHPUnit\Framework\Constraint\IsIdentical * @method \ryunosuke\PHPUnit\Actual eachIsIdentical($value) * @method \ryunosuke\PHPUnit\Actual isIdentical($value) * @method \ryunosuke\PHPUnit\Actual isNotIdentical($value) * @method \ryunosuke\PHPUnit\Actual isIdenticalAny(array $values) * @method \ryunosuke\PHPUnit\Actual isIdenticalAll(array $values) * @method \ryunosuke\PHPUnit\Actual isNotIdenticalAny(array $values) * @method \ryunosuke\PHPUnit\Actual isNotIdenticalAll(array $values) * * @see \PHPUnit\Framework\Constraint\JsonMatches * @method \ryunosuke\PHPUnit\Actual eachJsonMatches(string $value) * @method \ryunosuke\PHPUnit\Actual jsonMatches(string $value) * @method \ryunosuke\PHPUnit\Actual jsonNotMatches(string $value) * @method \ryunosuke\PHPUnit\Actual jsonMatchesAny(array $values) * @method \ryunosuke\PHPUnit\Actual jsonMatchesAll(array $values) * @method \ryunosuke\PHPUnit\Actual jsonNotMatchesAny(array $values) * @method \ryunosuke\PHPUnit\Actual jsonNotMatchesAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsFinite * @method \ryunosuke\PHPUnit\Actual eachIsFinite() * @method \ryunosuke\PHPUnit\Actual isFinite() * @method \ryunosuke\PHPUnit\Actual isNotFinite() * * @see \PHPUnit\Framework\Constraint\IsInfinite * @method \ryunosuke\PHPUnit\Actual eachIsInfinite() * @method \ryunosuke\PHPUnit\Actual isInfinite() * @method \ryunosuke\PHPUnit\Actual isNotInfinite() * * @see \PHPUnit\Framework\Constraint\IsNan * @method \ryunosuke\PHPUnit\Actual eachIsNan() * @method \ryunosuke\PHPUnit\Actual isNan() * @method \ryunosuke\PHPUnit\Actual isNotNan() * * @see \PHPUnit\Framework\Constraint\ClassHasAttribute * @method \ryunosuke\PHPUnit\Actual eachClassHasAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual classHasAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual classNotHasAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual classHasAttributeAny(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual classHasAttributeAll(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual classNotHasAttributeAny(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual classNotHasAttributeAll(array $attributeNames) * * @see \PHPUnit\Framework\Constraint\ClassHasStaticAttribute * @method \ryunosuke\PHPUnit\Actual eachClassHasStaticAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual classHasStaticAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual classNotHasStaticAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual classHasStaticAttributeAny(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual classHasStaticAttributeAll(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual classNotHasStaticAttributeAny(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual classNotHasStaticAttributeAll(array $attributeNames) * * @see \PHPUnit\Framework\Constraint\ObjectEquals * @method \ryunosuke\PHPUnit\Actual eachObjectEquals(object $object, string $method = "equals") * @method \ryunosuke\PHPUnit\Actual objectEquals(object $object, string $method = "equals") * @method \ryunosuke\PHPUnit\Actual objectNotEquals(object $object, string $method = "equals") * @method \ryunosuke\PHPUnit\Actual objectEqualsAny(array $objects, string $method = "equals") * @method \ryunosuke\PHPUnit\Actual objectEqualsAll(array $objects, string $method = "equals") * @method \ryunosuke\PHPUnit\Actual objectNotEqualsAny(array $objects, string $method = "equals") * @method \ryunosuke\PHPUnit\Actual objectNotEqualsAll(array $objects, string $method = "equals") * * @see \PHPUnit\Framework\Constraint\ObjectHasAttribute * @method \ryunosuke\PHPUnit\Actual eachObjectHasAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual objectHasAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual objectNotHasAttribute(string $attributeName) * @method \ryunosuke\PHPUnit\Actual objectHasAttributeAny(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual objectHasAttributeAll(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual objectNotHasAttributeAny(array $attributeNames) * @method \ryunosuke\PHPUnit\Actual objectNotHasAttributeAll(array $attributeNames) * * @see \PHPUnit\Framework\Constraint\IsJson * @method \ryunosuke\PHPUnit\Actual eachIsJson() * @method \ryunosuke\PHPUnit\Actual isJson() * @method \ryunosuke\PHPUnit\Actual isNotJson() * * @see \PHPUnit\Framework\Constraint\RegularExpression * @method \ryunosuke\PHPUnit\Actual eachRegularExpression(string $pattern) * @method \ryunosuke\PHPUnit\Actual regularExpression(string $pattern) * @method \ryunosuke\PHPUnit\Actual notRegularExpression(string $pattern) * @method \ryunosuke\PHPUnit\Actual regularExpressionAny(array $patterns) * @method \ryunosuke\PHPUnit\Actual regularExpressionAll(array $patterns) * @method \ryunosuke\PHPUnit\Actual notRegularExpressionAny(array $patterns) * @method \ryunosuke\PHPUnit\Actual notRegularExpressionAll(array $patterns) * * @see \PHPUnit\Framework\Constraint\StringContains * @method \ryunosuke\PHPUnit\Actual eachStringContains(string $string, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual stringContains(string $string, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual stringNotContains(string $string, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual stringContainsAny(array $strings, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual stringContainsAll(array $strings, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual stringNotContainsAny(array $strings, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual stringNotContainsAll(array $strings, bool $ignoreCase = false) * * @see \PHPUnit\Framework\Constraint\StringEndsWith * @method \ryunosuke\PHPUnit\Actual eachStringEndsWith(string $suffix) * @method \ryunosuke\PHPUnit\Actual stringEndsWith(string $suffix) * @method \ryunosuke\PHPUnit\Actual notStringEndsWith(string $suffix) * @method \ryunosuke\PHPUnit\Actual stringEndsWithAny(array $suffixs) * @method \ryunosuke\PHPUnit\Actual stringEndsWithAll(array $suffixs) * @method \ryunosuke\PHPUnit\Actual notStringEndsWithAny(array $suffixs) * @method \ryunosuke\PHPUnit\Actual notStringEndsWithAll(array $suffixs) * * @see \PHPUnit\Framework\Constraint\StringMatchesFormatDescription * @method \ryunosuke\PHPUnit\Actual eachStringMatchesFormatDescription(string $string) * @method \ryunosuke\PHPUnit\Actual stringMatchesFormatDescription(string $string) * @method \ryunosuke\PHPUnit\Actual stringNotMatchesFormatDescription(string $string) * @method \ryunosuke\PHPUnit\Actual stringMatchesFormatDescriptionAny(array $strings) * @method \ryunosuke\PHPUnit\Actual stringMatchesFormatDescriptionAll(array $strings) * @method \ryunosuke\PHPUnit\Actual stringNotMatchesFormatDescriptionAny(array $strings) * @method \ryunosuke\PHPUnit\Actual stringNotMatchesFormatDescriptionAll(array $strings) * * @see \PHPUnit\Framework\Constraint\StringStartsWith * @method \ryunosuke\PHPUnit\Actual eachStringStartsWith(string $prefix) * @method \ryunosuke\PHPUnit\Actual stringStartsWith(string $prefix) * @method \ryunosuke\PHPUnit\Actual notStringStartsWith(string $prefix) * @method \ryunosuke\PHPUnit\Actual stringStartsWithAny(array $prefixs) * @method \ryunosuke\PHPUnit\Actual stringStartsWithAll(array $prefixs) * @method \ryunosuke\PHPUnit\Actual notStringStartsWithAny(array $prefixs) * @method \ryunosuke\PHPUnit\Actual notStringStartsWithAll(array $prefixs) * * @see \PHPUnit\Framework\Constraint\ArrayHasKey * @method \ryunosuke\PHPUnit\Actual eachArrayHasKey($key) * @method \ryunosuke\PHPUnit\Actual arrayHasKey($key) * @method \ryunosuke\PHPUnit\Actual arrayNotHasKey($key) * @method \ryunosuke\PHPUnit\Actual arrayHasKeyAny(array $keys) * @method \ryunosuke\PHPUnit\Actual arrayHasKeyAll(array $keys) * @method \ryunosuke\PHPUnit\Actual arrayNotHasKeyAny(array $keys) * @method \ryunosuke\PHPUnit\Actual arrayNotHasKeyAll(array $keys) * * @see \PHPUnit\Framework\Constraint\TraversableContainsEqual * @method \ryunosuke\PHPUnit\Actual eachTraversableContainsEqual($value) * @method \ryunosuke\PHPUnit\Actual traversableContainsEqual($value) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsEqual($value) * @method \ryunosuke\PHPUnit\Actual traversableContainsEqualAny(array $values) * @method \ryunosuke\PHPUnit\Actual traversableContainsEqualAll(array $values) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsEqualAny(array $values) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsEqualAll(array $values) * * @see \PHPUnit\Framework\Constraint\TraversableContainsIdentical * @method \ryunosuke\PHPUnit\Actual eachTraversableContainsIdentical($value) * @method \ryunosuke\PHPUnit\Actual traversableContainsIdentical($value) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsIdentical($value) * @method \ryunosuke\PHPUnit\Actual traversableContainsIdenticalAny(array $values) * @method \ryunosuke\PHPUnit\Actual traversableContainsIdenticalAll(array $values) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsIdenticalAny(array $values) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsIdenticalAll(array $values) * * @see \PHPUnit\Framework\Constraint\TraversableContainsOnly * @method \ryunosuke\PHPUnit\Actual eachTraversableContainsOnly(string $type, bool $isNativeType = true) * @method \ryunosuke\PHPUnit\Actual traversableContainsOnly(string $type, bool $isNativeType = true) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsOnly(string $type, bool $isNativeType = true) * @method \ryunosuke\PHPUnit\Actual traversableContainsOnlyAny(array $types, bool $isNativeType = true) * @method \ryunosuke\PHPUnit\Actual traversableContainsOnlyAll(array $types, bool $isNativeType = true) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsOnlyAny(array $types, bool $isNativeType = true) * @method \ryunosuke\PHPUnit\Actual traversableNotContainsOnlyAll(array $types, bool $isNativeType = true) * * @see \PHPUnit\Framework\Constraint\IsInstanceOf * @method \ryunosuke\PHPUnit\Actual eachIsInstanceOf(string $className) * @method \ryunosuke\PHPUnit\Actual isInstanceOf(string $className) * @method \ryunosuke\PHPUnit\Actual isNotInstanceOf(string $className) * @method \ryunosuke\PHPUnit\Actual isInstanceOfAny(array $classNames) * @method \ryunosuke\PHPUnit\Actual isInstanceOfAll(array $classNames) * @method \ryunosuke\PHPUnit\Actual isNotInstanceOfAny(array $classNames) * @method \ryunosuke\PHPUnit\Actual isNotInstanceOfAll(array $classNames) * * @see \PHPUnit\Framework\Constraint\IsNull * @method \ryunosuke\PHPUnit\Actual eachIsNull() * @method \ryunosuke\PHPUnit\Actual isNull() * @method \ryunosuke\PHPUnit\Actual isNotNull() * * @see \PHPUnit\Framework\Constraint\IsType * @method \ryunosuke\PHPUnit\Actual eachIsType(string $type) * @method \ryunosuke\PHPUnit\Actual isType(string $type) * @method \ryunosuke\PHPUnit\Actual isNotType(string $type) * @method \ryunosuke\PHPUnit\Actual isTypeAny(array $types) * @method \ryunosuke\PHPUnit\Actual isTypeAll(array $types) * @method \ryunosuke\PHPUnit\Actual isNotTypeAny(array $types) * @method \ryunosuke\PHPUnit\Actual isNotTypeAll(array $types) * * @see \PHPUnit\Framework\Constraint\IsIdentical::__construct() * @method \ryunosuke\PHPUnit\Actual eachIsSame($value) * @method \ryunosuke\PHPUnit\Actual isSame($value) * @method \ryunosuke\PHPUnit\Actual isNotSame($value) * @method \ryunosuke\PHPUnit\Actual isSameAny(array $values) * @method \ryunosuke\PHPUnit\Actual isSameAll(array $values) * @method \ryunosuke\PHPUnit\Actual isNotSameAny(array $values) * @method \ryunosuke\PHPUnit\Actual isNotSameAll(array $values) * * @see \PHPUnit\Framework\Constraint\StringStartsWith::__construct() * @method \ryunosuke\PHPUnit\Actual eachPrefixIs(string $prefix) * @method \ryunosuke\PHPUnit\Actual prefixIs(string $prefix) * @method \ryunosuke\PHPUnit\Actual prefixIsNot(string $prefix) * @method \ryunosuke\PHPUnit\Actual prefixIsAny(array $prefixs) * @method \ryunosuke\PHPUnit\Actual prefixIsAll(array $prefixs) * @method \ryunosuke\PHPUnit\Actual prefixIsNotAny(array $prefixs) * @method \ryunosuke\PHPUnit\Actual prefixIsNotAll(array $prefixs) * * @see \PHPUnit\Framework\Constraint\StringEndsWith::__construct() * @method \ryunosuke\PHPUnit\Actual eachSuffixIs(string $suffix) * @method \ryunosuke\PHPUnit\Actual suffixIs(string $suffix) * @method \ryunosuke\PHPUnit\Actual suffixIsNot(string $suffix) * @method \ryunosuke\PHPUnit\Actual suffixIsAny(array $suffixs) * @method \ryunosuke\PHPUnit\Actual suffixIsAll(array $suffixs) * @method \ryunosuke\PHPUnit\Actual suffixIsNotAny(array $suffixs) * @method \ryunosuke\PHPUnit\Actual suffixIsNotAll(array $suffixs) * * @see \PHPUnit\Framework\Constraint\IsEqual::__construct() {"canonicalize":true} * @method \ryunosuke\PHPUnit\Actual eachEqualsCanonicalizing($value, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsCanonicalizing($value, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsCanonicalizing($value, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsCanonicalizingAny(array $values, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual equalsCanonicalizingAll(array $values, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsCanonicalizingAny(array $values, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * @method \ryunosuke\PHPUnit\Actual notEqualsCanonicalizingAll(array $values, float $delta = 0.0, bool $canonicalize = true, bool $ignoreCase = false) * * @see \PHPUnit\Framework\Constraint\IsEqual::__construct() {"ignoreCase":true} * @method \ryunosuke\PHPUnit\Actual eachEqualsIgnoreCase($value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * @method \ryunosuke\PHPUnit\Actual equalsIgnoreCase($value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * @method \ryunosuke\PHPUnit\Actual notEqualsIgnoreCase($value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * @method \ryunosuke\PHPUnit\Actual equalsIgnoreCaseAny(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * @method \ryunosuke\PHPUnit\Actual equalsIgnoreCaseAll(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * @method \ryunosuke\PHPUnit\Actual notEqualsIgnoreCaseAny(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * @method \ryunosuke\PHPUnit\Actual notEqualsIgnoreCaseAll(array $values, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = true) * * @see \PHPUnit\Framework\Constraint\RegularExpression::__construct() * @method \ryunosuke\PHPUnit\Actual eachMatches(string $pattern) * @method \ryunosuke\PHPUnit\Actual matches(string $pattern) * @method \ryunosuke\PHPUnit\Actual notMatches(string $pattern) * @method \ryunosuke\PHPUnit\Actual matchesAny(array $patterns) * @method \ryunosuke\PHPUnit\Actual matchesAll(array $patterns) * @method \ryunosuke\PHPUnit\Actual notMatchesAny(array $patterns) * @method \ryunosuke\PHPUnit\Actual notMatchesAll(array $patterns) * * @see \PHPUnit\Framework\Constraint\GreaterThan::__construct() * @method \ryunosuke\PHPUnit\Actual eachGt($value) * @method \ryunosuke\PHPUnit\Actual gt($value) * @method \ryunosuke\PHPUnit\Actual notGt($value) * @method \ryunosuke\PHPUnit\Actual gtAny(array $values) * @method \ryunosuke\PHPUnit\Actual gtAll(array $values) * @method \ryunosuke\PHPUnit\Actual notGtAny(array $values) * @method \ryunosuke\PHPUnit\Actual notGtAll(array $values) * * @see \PHPUnit\Framework\Constraint\LessThan::__construct() * @method \ryunosuke\PHPUnit\Actual eachLt($value) * @method \ryunosuke\PHPUnit\Actual lt($value) * @method \ryunosuke\PHPUnit\Actual notLt($value) * @method \ryunosuke\PHPUnit\Actual ltAny(array $values) * @method \ryunosuke\PHPUnit\Actual ltAll(array $values) * @method \ryunosuke\PHPUnit\Actual notLtAny(array $values) * @method \ryunosuke\PHPUnit\Actual notLtAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsEqual::__construct(),\PHPUnit\Framework\Constraint\GreaterThan::__construct() * @method \ryunosuke\PHPUnit\Actual eachGte($value) * @method \ryunosuke\PHPUnit\Actual gte($value) * @method \ryunosuke\PHPUnit\Actual notGte($value) * @method \ryunosuke\PHPUnit\Actual gteAny(array $values) * @method \ryunosuke\PHPUnit\Actual gteAll(array $values) * @method \ryunosuke\PHPUnit\Actual notGteAny(array $values) * @method \ryunosuke\PHPUnit\Actual notGteAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsEqual::__construct(),\PHPUnit\Framework\Constraint\LessThan::__construct() * @method \ryunosuke\PHPUnit\Actual eachLte($value) * @method \ryunosuke\PHPUnit\Actual lte($value) * @method \ryunosuke\PHPUnit\Actual notLte($value) * @method \ryunosuke\PHPUnit\Actual lteAny(array $values) * @method \ryunosuke\PHPUnit\Actual lteAll(array $values) * @method \ryunosuke\PHPUnit\Actual notLteAny(array $values) * @method \ryunosuke\PHPUnit\Actual notLteAll(array $values) * * @see \PHPUnit\Framework\Constraint\IsNull::__construct(),\PHPUnit\Framework\Constraint\IsType::__construct() ["string"] * @method \ryunosuke\PHPUnit\Actual eachIsNullOrString() * @method \ryunosuke\PHPUnit\Actual isNullOrString() * @method \ryunosuke\PHPUnit\Actual isNotNullOrString() * * @see \ryunosuke\PHPUnit\Constraint\OutputMatches::__construct() {"raw":true} * @method \ryunosuke\PHPUnit\Actual eachOutputContains($value, $raw = true, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputContains($value, $raw = true, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputNotContains($value, $raw = true, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputContainsAny(array $values, $raw = true, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputContainsAll(array $values, $raw = true, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputNotContainsAny(array $values, $raw = true, $with = ["", ""]) * @method \ryunosuke\PHPUnit\Actual outputNotContainsAll(array $values, $raw = true, $with = ["", ""]) * * @see \ryunosuke\PHPUnit\Constraint\OutputMatches::__construct() {"raw":true,"with":["\\A","\\z"]} * @method \ryunosuke\PHPUnit\Actual eachOutputEquals($value, $raw = true, $with = ["\\A", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputEquals($value, $raw = true, $with = ["\\A", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputNotEquals($value, $raw = true, $with = ["\\A", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputEqualsAny(array $values, $raw = true, $with = ["\\A", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputEqualsAll(array $values, $raw = true, $with = ["\\A", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputNotEqualsAny(array $values, $raw = true, $with = ["\\A", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputNotEqualsAll(array $values, $raw = true, $with = ["\\A", "\\z"]) * * @see \ryunosuke\PHPUnit\Constraint\OutputMatches::__construct() {"raw":true,"with":["\\A",""]} * @method \ryunosuke\PHPUnit\Actual eachOutputStartsWith($value, $raw = true, $with = ["\\A", ""]) * @method \ryunosuke\PHPUnit\Actual outputStartsWith($value, $raw = true, $with = ["\\A", ""]) * @method \ryunosuke\PHPUnit\Actual notOutputStartsWith($value, $raw = true, $with = ["\\A", ""]) * @method \ryunosuke\PHPUnit\Actual outputStartsWithAny(array $values, $raw = true, $with = ["\\A", ""]) * @method \ryunosuke\PHPUnit\Actual outputStartsWithAll(array $values, $raw = true, $with = ["\\A", ""]) * @method \ryunosuke\PHPUnit\Actual notOutputStartsWithAny(array $values, $raw = true, $with = ["\\A", ""]) * @method \ryunosuke\PHPUnit\Actual notOutputStartsWithAll(array $values, $raw = true, $with = ["\\A", ""]) * * @see \ryunosuke\PHPUnit\Constraint\OutputMatches::__construct() {"raw":true,"with":["","\\z"]} * @method \ryunosuke\PHPUnit\Actual eachOutputEndsWith($value, $raw = true, $with = ["", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputEndsWith($value, $raw = true, $with = ["", "\\z"]) * @method \ryunosuke\PHPUnit\Actual notOutputEndsWith($value, $raw = true, $with = ["", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputEndsWithAny(array $values, $raw = true, $with = ["", "\\z"]) * @method \ryunosuke\PHPUnit\Actual outputEndsWithAll(array $values, $raw = true, $with = ["", "\\z"]) * @method \ryunosuke\PHPUnit\Actual notOutputEndsWithAny(array $values, $raw = true, $with = ["", "\\z"]) * @method \ryunosuke\PHPUnit\Actual notOutputEndsWithAll(array $values, $raw = true, $with = ["", "\\z"]) * * @see \ryunosuke\PHPUnit\Constraint\IsThrowable::__construct() * @method \ryunosuke\PHPUnit\Actual eachWasThrown($expected = null) * @method \ryunosuke\PHPUnit\Actual wasThrown($expected = null) * @method \ryunosuke\PHPUnit\Actual notWasThrown($expected = null) * * @see \PHPUnit\Framework\Constraint\IsInstanceOf::__construct() ["ryunosuke\\PHPUnit\\Exception\\UndefinedException"] * @method \ryunosuke\PHPUnit\Actual eachIsUndefined() * @method \ryunosuke\PHPUnit\Actual isUndefined() * @method \ryunosuke\PHPUnit\Actual isNotUndefined() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["array"] * @method \ryunosuke\PHPUnit\Actual eachIsArray() * @method \ryunosuke\PHPUnit\Actual isArray() * @method \ryunosuke\PHPUnit\Actual isNotArray() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["bool"] * @method \ryunosuke\PHPUnit\Actual eachIsBool() * @method \ryunosuke\PHPUnit\Actual isBool() * @method \ryunosuke\PHPUnit\Actual isNotBool() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["float"] * @method \ryunosuke\PHPUnit\Actual eachIsFloat() * @method \ryunosuke\PHPUnit\Actual isFloat() * @method \ryunosuke\PHPUnit\Actual isNotFloat() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["int"] * @method \ryunosuke\PHPUnit\Actual eachIsInt() * @method \ryunosuke\PHPUnit\Actual isInt() * @method \ryunosuke\PHPUnit\Actual isNotInt() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["numeric"] * @method \ryunosuke\PHPUnit\Actual eachIsNumeric() * @method \ryunosuke\PHPUnit\Actual isNumeric() * @method \ryunosuke\PHPUnit\Actual isNotNumeric() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["object"] * @method \ryunosuke\PHPUnit\Actual eachIsObject() * @method \ryunosuke\PHPUnit\Actual isObject() * @method \ryunosuke\PHPUnit\Actual isNotObject() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["resource"] * @method \ryunosuke\PHPUnit\Actual eachIsResource() * @method \ryunosuke\PHPUnit\Actual isResource() * @method \ryunosuke\PHPUnit\Actual isNotResource() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["string"] * @method \ryunosuke\PHPUnit\Actual eachIsString() * @method \ryunosuke\PHPUnit\Actual isString() * @method \ryunosuke\PHPUnit\Actual isNotString() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["scalar"] * @method \ryunosuke\PHPUnit\Actual eachIsScalar() * @method \ryunosuke\PHPUnit\Actual isScalar() * @method \ryunosuke\PHPUnit\Actual isNotScalar() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["callable"] * @method \ryunosuke\PHPUnit\Actual eachIsCallable() * @method \ryunosuke\PHPUnit\Actual isCallable() * @method \ryunosuke\PHPUnit\Actual isNotCallable() * * @see \PHPUnit\Framework\Constraint\IsType::__construct() ["iterable"] * @method \ryunosuke\PHPUnit\Actual eachIsIterable() * @method \ryunosuke\PHPUnit\Actual isIterable() * @method \ryunosuke\PHPUnit\Actual isNotIterable() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["alnum"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeAlnum() * @method \ryunosuke\PHPUnit\Actual isCtypeAlnum() * @method \ryunosuke\PHPUnit\Actual isNotCtypeAlnum() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["alpha"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeAlpha() * @method \ryunosuke\PHPUnit\Actual isCtypeAlpha() * @method \ryunosuke\PHPUnit\Actual isNotCtypeAlpha() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["cntrl"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeCntrl() * @method \ryunosuke\PHPUnit\Actual isCtypeCntrl() * @method \ryunosuke\PHPUnit\Actual isNotCtypeCntrl() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["digit"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeDigit() * @method \ryunosuke\PHPUnit\Actual isCtypeDigit() * @method \ryunosuke\PHPUnit\Actual isNotCtypeDigit() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["graph"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeGraph() * @method \ryunosuke\PHPUnit\Actual isCtypeGraph() * @method \ryunosuke\PHPUnit\Actual isNotCtypeGraph() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["lower"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeLower() * @method \ryunosuke\PHPUnit\Actual isCtypeLower() * @method \ryunosuke\PHPUnit\Actual isNotCtypeLower() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["print"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypePrint() * @method \ryunosuke\PHPUnit\Actual isCtypePrint() * @method \ryunosuke\PHPUnit\Actual isNotCtypePrint() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["punct"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypePunct() * @method \ryunosuke\PHPUnit\Actual isCtypePunct() * @method \ryunosuke\PHPUnit\Actual isNotCtypePunct() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["space"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeSpace() * @method \ryunosuke\PHPUnit\Actual isCtypeSpace() * @method \ryunosuke\PHPUnit\Actual isNotCtypeSpace() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["upper"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeUpper() * @method \ryunosuke\PHPUnit\Actual isCtypeUpper() * @method \ryunosuke\PHPUnit\Actual isNotCtypeUpper() * * @see \ryunosuke\PHPUnit\Constraint\IsCType::__construct() ["xdigit"] * @method \ryunosuke\PHPUnit\Actual eachIsCtypeXdigit() * @method \ryunosuke\PHPUnit\Actual isCtypeXdigit() * @method \ryunosuke\PHPUnit\Actual isNotCtypeXdigit() * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["int"] * @method \ryunosuke\PHPUnit\Actual eachIsValidInt($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidInt($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidInt($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["float"] * @method \ryunosuke\PHPUnit\Actual eachIsValidFloat($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidFloat($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidFloat($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["email"] * @method \ryunosuke\PHPUnit\Actual eachIsValidEmail($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidEmail($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidEmail($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["ip"] * @method \ryunosuke\PHPUnit\Actual eachIsValidIp($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidIp($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidIp($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["ipv4"] * @method \ryunosuke\PHPUnit\Actual eachIsValidIpv4($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidIpv4($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidIpv4($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["ipv6"] * @method \ryunosuke\PHPUnit\Actual eachIsValidIpv6($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidIpv6($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidIpv6($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["mac"] * @method \ryunosuke\PHPUnit\Actual eachIsValidMac($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidMac($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidMac($flags = 0) * * @see \ryunosuke\PHPUnit\Constraint\IsValid::__construct() ["url"] * @method \ryunosuke\PHPUnit\Actual eachIsValidUrl($flags = 0) * @method \ryunosuke\PHPUnit\Actual isValidUrl($flags = 0) * @method \ryunosuke\PHPUnit\Actual isNotValidUrl($flags = 0) * * @see tests/bootstrap.php#18-20 * @method \ryunosuke\PHPUnit\Actual eachLineCount(int $lineCount, string $delimiter = "\\R") * @method \ryunosuke\PHPUnit\Actual lineCount(int $lineCount, string $delimiter = "\\R") * @method \ryunosuke\PHPUnit\Actual notLineCount(int $lineCount, string $delimiter = "\\R") * @method \ryunosuke\PHPUnit\Actual lineCountAny(array $lineCounts, string $delimiter = "\\R") * @method \ryunosuke\PHPUnit\Actual lineCountAll(array $lineCounts, string $delimiter = "\\R") * @method \ryunosuke\PHPUnit\Actual notLineCountAny(array $lineCounts, string $delimiter = "\\R") * @method \ryunosuke\PHPUnit\Actual notLineCountAll(array $lineCounts, string $delimiter = "\\R") * */ trait Annotation { function isHoge() { return $this->eval(new \PHPUnit\Framework\Constraint\IsEqual('hoge')); } }
true
3a234b1349efaf99976f4607d27fd2ab8ff9a3c2
PHP
bemyguest/settings
/src/Krucas/Settings/Contracts/ContextSerializer.php
UTF-8
311
2.671875
3
[ "MIT" ]
permissive
<?php namespace Krucas\Settings\Contracts; use Krucas\Settings\Context; interface ContextSerializer { /** * Serialize context into a string representation. * * @param \Krucas\Settings\Context $context * @return string */ public function serialize(Context $context = null); }
true
5a8ce119b1a47055405169b695613fb9c34a5004
PHP
michaelhaikal31/MASTER-REST-CI
/application/models/Tabungan_model.php
UTF-8
3,022
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
<?php class Tabungan_model extends CI_Model { public function update_saldo($nominal, $id_student) { $sql = "UPDATE t_student SET saldo = saldo + '$nominal' WHERE id_student = '$id_student'"; $this->db->query($sql); } public function getDataTabungan($id_room = null, $id_period = null) { $null = NULL; $this->db->select('t_student.`name` AS nama, t_student.id_student, t_period.period AS name_period, t_room.room AS name_room, t_student.id_period, IF(t_student.saldo != "$null", t_student.saldo ,0) AS money, t_student.id_room'); $this->db->from('t_student'); $this->db->join('t_room', 't_room.id_room = t_student.id_room', 'left'); $this->db->join('t_period', 't_period.id_period = t_student.id_period', 'left'); $this->db->where('t_room.id_room', $id_room); $this->db->where('t_period.id_period', $id_period); $query = $this->db->get(); return $query->result_array(); } public function getTotalTabungan($date) { $result = $this->db->select('sum(nominal) as total_tabungan ') ->from('t_tabungan') ->where('year(date)',$date) ->get()->row(); return $result; } public function getTabungan($id_student ) { $result = $this->db->select('sum(nominal as value')->from('t_tabungan')->get()->row(); return $result->value; } public function addTabungan($data) { $this->db->insert('t_tabungan', $data); } public function getDataKredit($id_student){ $this->db->select(' t_tabungan.id_tabungan, t_tabungan.date, t_tabungan.keterangan, t_tabungan.nominal, t_tabungan.type,'); $this->db->from('t_tabungan'); $this->db->where('t_tabungan.id_student', $id_student); $this->db->where('t_tabungan.nominal >', 0); $query = $this->db->get(); return $query->result_array(); } public function getDataDebet($id_student){ $this->db->select(' t_tabungan.id_tabungan, t_tabungan.date, t_tabungan.keterangan, t_tabungan.nominal, t_tabungan.type,' ); $this->db->from('t_tabungan'); $this->db->where('t_tabungan.id_student', $id_student); $this->db->where('t_tabungan.nominal <', 0); $query = $this->db->get(); return $query->result_array(); } public function getDataMutasi($id_student, $tgl_awal, $tgl_akhir){ $sql = "SELECT t_tabungan.id_tabungan, t_tabungan.nominal, t_tabungan.keterangan, t_tabungan.date, t_tabungan.type FROM t_tabungan WHERE t_tabungan.date BETWEEN '$tgl_awal' AND '$tgl_akhir' AND t_tabungan.id_student = '$id_student'"; $query = $this->db->query($sql); return $query->result_array(); } public function editDataTabungan($nominal, $keterangan, $id){ $sql = "UPDATE t_tabungan SET nominal='$nominal', keterangan='$keterangan' WHERE id_tabungan='$id'"; $this->db->query($sql); return $this->db->affected_rows(); } public function deleteDataTabungan($id){ $sql = "DELETE FROM t_tabungan WHERE id_tabungan = '$id'"; $this->db->query($sql); return $this->db->affected_rows(); } }
true
82e3ee97c3ad50e458e1a7a45b9fe2c686bb714e
PHP
Kappappa/ikupaca
/inc/pdo/create_table.php
UTF-8
1,017
2.5625
3
[]
no_license
<?php // create_table.php // 設定(パス要確認) include_once("../config.php"); /* table作成 */ //[News] // news_id // news_create_time // news_text $sql_news= 'create table if not exists News( news_id int not null auto_increment, news_create_time datetime not null, news_title varchar(100) not null, news_text text not null, primary key(news_id) )character set utf8;'; $res_news= $pdo -> prepare($sql_news); $res_news -> execute(); // 初期登録 $sql_news_insert = $pdo -> prepare("INSERT INTO News (news_create_time, news_title, news_text) VALUES (:time, :title, :text);"); $sql_news_insert -> bindParam(':time', $time, PDO::PARAM_STR); $sql_news_insert -> bindParam(':title', $title, PDO::PARAM_STR); $sql_news_insert -> bindParam(':text', $text, PDO::PARAM_STR); $time= date('Y-m-d H:i:s'); $title= "タイトル"; $text= "テスト"; $sql_news_insert -> execute(); //echo "My_Do_OK.ini"; header("Location: ../../admin/news.php"); exit(); ?>
true
7066a5c6f777fc319e1e36d86bd1fe0fc9880a9d
PHP
alvinoalvin/alvinoalvin.github.io
/prev_projects/atropos/pantsM.php
UTF-8
1,665
2.90625
3
[]
no_license
<!DOCTYPE html> <?php include_once 'headtag.php'; ?> <body> <!-- Database connection!--> <?php //FOR TWIG require_once './vendor/autoload.php'; $loader = new Twig_Loader_Filesystem('./templates'); $twig = new Twig_Environment($loader); include_once 'db.php'; $headerTemp = $twig->load('header.html'); $contentTemp = $twig->load('tableM.html'); $footerTemp = $twig->load('footer.html'); //FOR DATABASE $pants = array(); // -----------------------------------------FOR TABLE----------------------------------------- //call procedure1 if (!$conn->multi_query("CALL getPants()")) { echo "CALL failed: (" . $mysqli->errno . ") " . $mysqli->error; } $result =$conn->store_result(); //PRINT RESULT if (mysqli_num_rows($result) > 0) { //output data of each row while($row = mysqli_fetch_array($result)) { $pants[] = $row; } } // close connection $conn->close(); ?> <div class="wrapper"> <!--Header template!--> <?php include_once 'header.php'; include_once 'navbar.php'; ?> <!--content template--> <?php echo $contentTemp->render(array( "contArr" => $pants, "subtitle" => "Pants" )); ?> <!--footer template--> <?php echo $footerTemp->render(array( )); ?> </div><!-- End of Wrapper!--> </body>
true
009fb0dfb9177082be9ddf443d7aafea0a38eeb2
PHP
thiagodias63/agenda
/_app/Models/FuncionariosSS.class.php
UTF-8
543
2.703125
3
[ "MIT" ]
permissive
<?php /** * @copyright (c) 2017, Thiago Dias */ class FuncionariosSS{ private $Id; private $Funcionario; private $Agendamento; private $Error; private $Result; public function AdicionarFuncionarioSS(array $ListaFuncionario){ $create = new Create; try{ $create->ExeCreate("funcionarios_ss",$ListaFuncionario); $this->Result = $create->getResult(); } catch (Exception $e){ $this->Result = $e->Message; } } public function getResult(){ return $this->Result; } public function getError(){ return $this->Error; } }
true
93069ebda066bc2e01c9249924101e35cdd7cf11
PHP
felipe4726/bdr-teste
/src/vendor/Database.php
UTF-8
5,807
3.125
3
[]
no_license
<?php namespace Bdr\Vendor; use PDO, PDOException, PDOStatement; $dbvar = ""; // guarda dados sobre a utilização da base de dados $dbc = 0; // SQL count $pdo = null; class Database { //Inicio do banco de dados public static function init(\Bdr\Sistema $sistema) { global $pdo; try { $pdo = new PDO('mysql:dbname=' . $sistema->database . ';host=localhost;charset=utf8', $sistema->db_user, $sistema->db_pass); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { echo '<h3>Não foi possível conectar com o banco de dados</h3>'; return false; } return true; } /** * @param $sql * @param PDOStatement $result * @param int $numrows * @param int $abortonerror * @return bool */ public static function dbaction($sql, &$result, &$numrows, $abortonerror = 0, $maintablename = '') { global $dbvar, $dbc, $pdo; $dbc++; $dbvar .= $sql . "\n"; try { $result = $pdo->query($sql); if ($result !== false) { if (strpos(" " . $sql, "SELECT") > 0) { if (strpos($sql . ' ', 'LIMIT 1 ') > 0) { return true; //Selects de uma linha retornam true sem setar $numrows porque não importa o tamanho total } if (strpos(preg_replace("/\([^)]+\)/", "", $sql), 'ORDER BY')) { $sql = substr($sql, 0, strrpos($sql, "ORDER BY")); } elseif (strpos($sql, 'LIMIT') > 0) { $sql = substr($sql, 0, strpos($sql, 'LIMIT')); } $groupPos = 0; if (strpos(preg_replace("/\([^)]+\)/", "", $sql), 'GROUP BY')) //se existe group by fora de parenteses pois pode ser na subquery $groupPos = strrpos($sql, 'GROUP BY'); $fromPos = strpos($sql, str_replace(" ", " ", "FROM " . $maintablename . " ")); if ($groupPos > 0) { $sql = substr($sql, 0, 7) . " COUNT(DISTINCT " . substr($sql, $groupPos + 9) . " ) " . substr($sql, $fromPos, $groupPos - $fromPos); } else { $sql = substr($sql, 0, 7) . " COUNT(*) " . substr($sql, $fromPos); } $rowCountQuery = $pdo->query($sql); $dbvar .= $sql; $numrows = $rowCountQuery->fetchColumn(); //Nesse caso vai retornar o total de registros possíveis removendo o LIMIT da query se tiver } else { $numrows = $result->rowCount(); //aqui mostra quantas linha foram afetadas } return true; } else if ($abortonerror) { $err = print_r($result->errorInfo(), true); Database::reporterror($err . "\nEm: " . $sql); die ($err . "\n" . $sql); } else { Database::reporterror(print_r($result->errorInfo(), true) . "\nEm: " . $sql); $dbvar .= "ERR\n"; return false; } } catch (PDOException $e) { echo "Erro na query:" . $sql; echo "<br> <br>"; echo $e->getMessage(); echo "Query History Stack Trace: " . $dbvar; } } public static function dbactionf($sql, $abortonerror = 0) { global $dbvar, $dbc, $pdo; $dbc++; $dbvar .= $sql . "\n"; $exec = $pdo->exec($sql); if ($exec !== false) { return true; } elseif ($abortonerror) { $err = print_r($exec->errorInfo(), true); Database::reporterror($err . "\nEm: " . $sql); die($err . "\n" . $sql . "\n" . print_r($exec, true) . "\n" . print_r($pdo)); } else { Database::reporterror(print_r($exec->errorInfo(), true) . "\nEm: " . $sql); $dbvar .= "ERR\n"; return false; } } public static function lastID() { global $pdo; return $pdo->lastInsertId(); } public static function reporterror($erro) { Log::erro($erro); Mail::reportError($erro); } public static function logout() { if (isset($_SERVER['HTTP_COOKIE'])) { $cookies = explode(';', $_SERVER['HTTP_COOKIE']); foreach ($cookies as $cookie) { $parts = explode('=', $cookie); $name = trim($parts[0]); setcookie($name, '', time() - 1000); setcookie($name, '', time() - 1000, '/'); } } $app = \Bdr\Sistema::app(); $router = Router::getRouter(); @session_unset(); @session_destroy(); @session_start(); $_SESSION['router'] = $router; $_SESSION['app'] = $app; sleep(1); // força cookies expirarem } public static function close() { global $pdo; unset($pdo); } function dbactionsr($sql, $index = 0, $abortonerror = 0) { global $dbvar, $dbc, $debugmode, $pdo; $dbc++; $dbvar .= $sql . "\n"; $result = $pdo->query($sql); if ($result && $result->rowCount($result) > 0) { return $result->fetchColumn($index); } else if ($abortonerror) { $err = print_r($result->errorInfo()); Database::reporterror($err . "\n\nEm: " . $sql); die ($err . "\n" . $sql); } return ""; } public static function get_num_queries() { global $dbc; return $dbc; } } ?>
true
3a4c1e3c887a5b106992fbd38465be63be66e869
PHP
manh-trinhquoc/awesome-wordpress
/plugins/cart66/pro/models/Cart66OrderFulfillment.php
UTF-8
2,192
2.65625
3
[]
no_license
<?php class Cart66OrderFulfillment extends Cart66ModelAbstract { public function __construct($id=null) { $this->_tableName = Cart66Common::getTableName('order_fulfillment'); parent::__construct($id); } public function save() { $errors = $this->validate(); if(count($errors) == 0) { $fulfillmentSave = parent::save(); } if(count($errors)) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] " . get_class($this) . " save errors: " . print_r($errors, true)); $this->setErrors($errors); $errors = print_r($errors, true); throw new Cart66Exception('Order fulfillment save failed: ' . $errors, 66303); } return $fulfillmentSave; } public function validate() { $errors = array(); if(empty($this->name)) { $errors['name'] = __('A name is required for order fulfillment', 'cart66'); } if(!Cart66Common::isValidEmail($this->email)) { $errors['email'] = __('Please enter a valid email address', 'cart66'); } if(empty($this->email)) { $errors['email'] = __('Email is required for order fulfillment', 'cart66'); } return $errors; } public function productNames() { $product = new Cart66Product(); $ids = explode(',', $this->products); $selected = array(); foreach($ids as $id) { $product->load($id); $selected[] = array('id' => $id, 'name' => $product->name); } return $selected; } public function checkFulfillmentSettings($orderId) { $order = new Cart66Order($orderId); $data = array(); foreach($order->getItems() as $item) { $data[] = $item->product_id; } $orderFulfillment = new Cart66OrderFulfillment(); $orderF = $orderFulfillment->getModels(); $notify = new Cart66AdvancedNotifications($orderId); foreach($orderF as $of) { $products = array_filter(explode(',', $of->products)); if(array_intersect($data, $products) || empty($products)) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] THEY INTERSECT!"); $notify->sendOrderFulfillmentEmails($of->id); } } } }
true
1a439b314cf16de8bdf7abdc66e9137c2c662121
PHP
Anuradha1994herath/Trainee_Management_System
/mjs/mdata.php
UTF-8
1,785
2.640625
3
[]
no_license
<?php header('Content-Type: application/json'); $servername = "localhost"; $uname = "root"; $passwd = ""; $dbname = "inoc"; // Create connection $mysqli = new mysqli($servername, $uname, $passwd, $dbname); // Check connection if ($mysqli->connect_error) { die("Connection failed: " . $mysqli->connect_error); } $type1=0; $type2=0; $type3=0; $type4=0; $type5=0; $type6=0; $type7=0; // print json_encode($data); $query="SELECT * from cumalative_sitecnt;"; $result=$mysqli->query($query) or die ($mysqli->error); //store the entire response $response = array(); //the array that will hold the titles and links $data = array(); while($row=$result->fetch_assoc()) //mysql_fetch_array($sql) { $type=$row['month']; $a=$row['2G']; $type1=$type1+$a; $b=$row['3G']; $type2=$type2+$b; $c=$row['LTE']; $type3=$type3+$c; $d=$row['Pico-2G']; $type4=$type4+$d; $e=$row['Pico-3G']; $type5=$type5+$e; $f=$row['Pico']; $type6=$type6+$f; $g=$row['total']; $type7=$type7+$g; //$textWare01_HU=$row['score']; // //each item from the rows go in their respective vars and into the data array //$data[] = array('Type'=> $type,'type1'=> $type1,'type2'=> $type2,'type3'=> $type3); $data[] = array('Type'=> $type,'type1'=> $type1,'type2'=> $type2,'type3'=> $type3,'type4'=> $type4,'type5'=> $type5,'type6'=> $type6,'type7'=> $type7); } //the data array goes into the response //$response['data'] = $data; //creates the file echo json_encode($data); // Date // textWare_HU // textWare01_HU // textWare02_HU // textWare02_ZTE // textWare01_ZTE // textWare03_ZTE // textWare_ZTE ?>
true
9517cac41e7fd78182621a9fff717238ef24ca79
PHP
isaponsoft/libamtrs
/src/amtrs/.old/win32/opengl.inc/gen_api_table.php
UTF-8
1,007
2.609375
3
[ "BSD-2-Clause" ]
permissive
<?php $header_filename = $argv[1]; $header = file_get_contents($header_filename); $lines = []; $basename = pathinfo($header_filename)['filename']; $fnames = []; $maxlen = 0; foreach (explode("\n", $header) as $line) { $lines[] = trim($line); if (preg_match('/GLAPI[ \t]+(\w+) APIENTRY[ \t]+(\w+)[ \t]*\(([\w \t\*,]+)\)/', $line, $m)) { $fnames[] = $m[2]; $len = strlen($m[2]); if ($len > $maxlen) { $maxlen = $len; } } } $fp = fopen("{$basename}-value.hpp", "w"); foreach ($fnames as $fname) { $ftype = strtoupper($fname); $space = $maxlen + 2 - strlen($ftype); $fmt = "PFN%sPROC%{$space}s%s;\n"; fprintf($fp, $fmt, $ftype, " ", $fname); } fclose($fp); $fp = fopen("{$basename}-init.hpp", "w"); foreach ($fnames as $fname) { $ftype = strtoupper($fname); $space = $maxlen + 2 - strlen($ftype); $fmt = "%s%{$space}s = (PFN%sPROC)wglGetProcAddress(\"%s\");\n"; fprintf($fp, $fmt, $fname, "", $ftype, $fname); } fclose($fp);
true
3900ffbd21a227f286d211c6bc96a8ab28940bed
PHP
Warziik/sforum
/src/Notifications/AccountConfirmationNotification.php
UTF-8
1,139
2.75
3
[ "MIT" ]
permissive
<?php namespace App\Notifications; use App\Entity\User; use Twig\Environment; class AccountConfirmationNotification { /** * @var \Swift_Mailer */ private $mailer; /** * @var Environment */ private $renderer; /** * ForgotPasswordNotification constructor. * @param \Swift_Mailer $mailer * @param Environment $renderer */ public function __construct(\Swift_Mailer $mailer, Environment $renderer) { $this->mailer = $mailer; $this->renderer = $renderer; } /** * @param User $user */ public function notify(User $user): void { try { $message = (new \Swift_Message('Confirmation de votre compte - SForum')) ->setFrom('noreply@sforum.com') ->setTo($user->getEmail()) ->setBody($this->renderer->render('emails/accountconfirmation.html.twig', ['user' => $user]), 'text/html'); $this->mailer->send($message); } catch (\Exception $e) { echo "Une erreur s'est produite lors de l'envoi de l'email. (debug: " . $e->getMessage() . ")"; } } }
true
2084f58b06524e6d26fad788119d5d8547efa3e4
PHP
sirshaun/demo-app-be
/app/Services/DestinationService.php
UTF-8
1,046
2.578125
3
[]
no_license
<?php namespace App\Services; use App\Models\PopularDestination; use Illuminate\Support\LazyCollection; class DestinationService { public static function search(?string $term): array { $destinations = PopularDestination::cursor(); return self::tranform($destinations); } protected static function tranform(LazyCollection $destinations): array { $arr = []; foreach ($destinations as $destination) { array_push( $arr, (object) [ 'city' => $destination->city, 'averagePrice' => formatMoneyAndTrimZeros($destination->average_price/100), 'propertyCount' => $destination->property_count, 'imageUrl' => $destination->images()->first()->attachment, 'imageAlt' => $destination->images()->first()->title, 'propertiesUrl' => '/properties/' . $destination->city, ] ); } return $arr; } }
true
ccd5e10b69a32d6d6c305cbd846ca7c1cde00277
PHP
EvanOnTheWay/lumen-api
/app/Http/Controllers/System/RoleController.php
UTF-8
5,828
2.65625
3
[]
no_license
<?php /** * Created by PhpStorm. * @author Wenpeng * @email imwwp@outlook.com * @time 2019-04-11 16:26:18 */ namespace App\Http\Controllers\System; use App\Http\ResponseScrmWrapper; use App\Http\ResponseStatus; use App\Models\System\SystemRole; use App\Services\SystemMenuService; use App\Services\SystemRoleService; use Illuminate\Http\Request; use Laravel\Lumen\Routing\Controller; use Validator; /** * SCRM SYSTEM Menu控制器 * * @package App\Http\Controllers\System */ class RoleController extends Controller { private $roleService; public function __construct() { $this->roleService = SystemRoleService::newInstance(); } /** * 获取指定用户的角色信息 * * @param Request $request * @return array */ public function getUserRoleList(Request $request) { $validator = Validator::make($request->all(), [ 'id' => 'required', ]); if ($validator->fails()) { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_WRONG_PARAM, $validator->errors()->toArray()); } $id = $request->get('id'); $listInfo = $this->roleService->getUserRoleList($id); return ResponseScrmWrapper::success($listInfo); } /** * 获取全部角色 * * @param Request $request * @return array */ public function getRoleList(Request $request) { $listInfo = $this->roleService->getRoleList(); return ResponseScrmWrapper::success($listInfo); } /** * 增加一个角色 * * @param Request $request * @return array */ public function addRole(Request $request) { $validator = Validator::make($request->all(), [ 'name' => 'required', ]); if ($validator->fails()) { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_WRONG_PARAM, $validator->errors()->toArray()); } $requestData = $request->all(); $systemRole = new SystemRole(); $systemRole->name = $requestData['name']; if(!empty($requestData['comment'])){ $systemRole->comment = $requestData['comment']; } $menuIdInfo = $this->roleService->addRole($systemRole); if ($menuIdInfo) { return ResponseScrmWrapper::success(['id'=>$menuIdInfo]); } else { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_REPEAT_ROLE); } } /** * 修改一个角色 * * @param Request $request * @return array */ public function editRole(Request $request) { $validator = Validator::make($request->all(), [ 'id' => 'required' ]); if ($validator->fails()) { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_WRONG_PARAM, $validator->errors()->toArray()); } $requestData = $request->all(); $systemRole = new SystemRole(); $systemRole->id = $requestData['id']; if(!empty($requestData['comment'])){ $systemRole->comment = $requestData['comment']; } if(!empty($requestData['name'])){ $systemRole->name = $requestData['name']; } if(isset($requestData['active_state'])){ $systemRole->active_state = $requestData['active_state']; } $flag = $this->roleService->editRole($systemRole); if ($flag) { return ResponseScrmWrapper::success(); } else { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_UPDATE_ERROR); } } /** * 删除一个角色 * * @param Request $request * @return array */ public function delRole(Request $request) { $validator = Validator::make($request->all(), [ 'id' => 'required' ]); if ($validator->fails()) { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_WRONG_PARAM, $validator->errors()->toArray()); } $id = $request->get('id'); $flag = $this->roleService->delRole($id); if ($flag) { return ResponseScrmWrapper::success(); } else { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_DEL_ERROR); } } /** * 为用户分配角色 * * @param Request $request * @return array */ public function addUserRole(Request $request) { $validator = Validator::make($request->all(), [ 'user_id' => 'required', 'role_id' => 'present', ]); if ($validator->fails()) { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_WRONG_PARAM, $validator->errors()->toArray()); } $userId = $request->get('user_id'); $roleIds = $request->get('role_id'); $flag = $this->roleService->addUserRole($userId,$roleIds); if ($flag) { return ResponseScrmWrapper::success($flag); } else { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_ADD_USER_ROLE_ERROR); } } /** * 获取单个角色信息 * * @param Request $request * @return array */ public function getRoleById(Request $request) { $validator = Validator::make($request->all(), [ 'id' => 'required', ]); if ($validator->fails()) { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_WRONG_PARAM, $validator->errors()->toArray()); } $id = $request->get('id'); $info = $this->roleService->getRoleById($id); if ($info) { return ResponseScrmWrapper::success($info); } else { return ResponseScrmWrapper::failure(ResponseStatus::SCRM_ROLE_ID_ERROR); } } }
true
b2310b7a15599a01c3bc72fddfe9734f9326d272
PHP
kfrerichs/paperbyte
/blog/app/Http/Controllers/GroupController.php
UTF-8
1,192
2.546875
3
[ "MIT" ]
permissive
<?php namespace App\Http\Controllers; use App\Models\Character; use App\Models\Group; use App\Models\Job; use Auth; class GroupController extends Controller { public function getOverview(){ if(Auth::user()->hasRole('player')) { $character = Character::where('user', Auth::user()->name)->first(); //Charakter des angemeldeten Users $group = Group::where('charactername', $character->name)->first(); // Name der Gruppe in der der Charakter sich befindet } if(Auth::user()->hasRole('master')) { $character = 'master'; $group = Group::where('charactername', $character)->where('username', Auth::user()->name)->first(); } $members = Group::where('name',$group->name)->get(); $allCharacters = Character::all(); return view('group.group')->with('members', $members)->with('allCharacters', $allCharacters)->with('character', $character); } public function getDetail($id=null){ $character = Character::find($id); $job = Job::find($id); return view('group.group_character')->with('character', $character)->with('job', $job); } }
true
77a09efdb711ddaf2bafcf8d019bf83cbca5b32c
PHP
PDanielski/mt2-shop-api
/src/Document/ItemShopItemInterface.php
UTF-8
304
2.53125
3
[]
no_license
<?php namespace App\Document; interface ItemShopItemInterface { public function getId(); public static function getType(); public function getName(); public function getDesc(); public function isMultilingual(); public function getPrices(); public function getCategory(); }
true
19f240ce163f9378a178f25119bcba8399e87379
PHP
kokaleros/CodeLab-CMS
/application/models/Shipment.php
UTF-8
3,246
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
<?php Class Shipment extends CI_Model{ public function __construct() { parent::__construct(); } private $shipment_table = "shipments"; public function create($data = "") { if(!is_array($data)){ echo "Create shipment: input data isnt array!"; return false; } //insert into database if( $shipment = $this->db->insert($this->shipment_table, $data)) { return $this->db->insert_id(); }else{ return false; } } public function edit($id = '', $data = ''){ if(!is_array($data)){ echo "Edit shipment: input data isnt array!"; return false; } $this->db->where('shipment_id',$id); $result = $this->db->update($this->shipment_table, $data); if($result){ return true; }else{ return false; } } public function delete($id=''){ $this->db->where('shipment_id', $id); $user_delete = $this->db->delete($this->shipment_table); if($user_delete){ return true; }else{ return false; } } public function get_shipment_by_id($id){ $this->db->where('shipment_id',$id); $result = $this->db->get($this->shipment_table); return $result->num_rows() == 1 ? $result->row() : false; } public function get_all_shipments(){ $this->db->order_by('vrijeme', "DESC"); $result = $this->db->get($this->shipment_table); return $result->num_rows() > 0 ? $result->result() : false; } public function get_all_shipments_from_user($id){ $this->db->where('user_id', $id); $this->db->order_by('vrijeme', "DESC"); $result = $this->db->get($this->shipment_table); return $result->num_rows() > 0 ? $result->result() : false; } // FOR TRACKING public function get_shipment_by_tracking_number($tracking_number){ $this->db->where('tracking_number',$tracking_number); $result = $this->db->get($this->shipment_table); return $result->num_rows() == 1 ? $result->row() : false; } public function create_note($data = "") { if(!is_array($data)){ echo "Create shipment note: input data isnt array!"; return false; } //insert into database if( $shipment = $this->db->insert('shipment_notes', $data)) { return $this->db->insert_id(); }else{ return false; } } public function get_all_notes($shipment_id = ''){ $this->db->where('shipment_id', $shipment_id); $this->db->order_by('time', "DESC"); $result = $this->db->get("shipment_notes"); return $result->num_rows() > 0 ? $result->result() : false; } //custom functions ------------------------------------------------------------- private function update_last_login($id){ $this->db->set('last_login', time()); $this->db->where('id', $id); $this->db->update($this->user_table); } private function isMD5($md5 ='') { return preg_match('/^[a-f0-9]{32}$/', $md5); } }
true
1b14cc0eaa5b98c9d30c79ded4f7b89fb49c2fd8
PHP
sow91/web-services
/getKitViewPatientPhotos.php
UTF-8
1,181
2.59375
3
[]
no_license
<?php // json response $response = array(); # check patient_id if (isset($_GET['patientId'])){ # get fields $id_patient = $_GET['patientId']; # include de connexion file require "db_connect.php"; # connexion to DB $conn = new DB_CONNECT(); # sql query $sql = "select id_image, ima_libelle, ima_nom from image im where im.id_personne = $id_patient "; # execute query $response['images'] = array(); $result = ibase_query($sql) or die(ibase_errmsg()); // number of line $nombreLigne = 0; while ($row = ibase_fetch_row($result)) { $nombreLigne++; $image = array(); $image['id_image'] = utf8_encode($row[0]); $image['ima_libelle'] = utf8_encode($row[1]); $image['ima_nom'] = utf8_encode($row[2]); array_push($response['images'], $image); } if ($nombreLigne != 0) { $response['success'] = 1; //convert array to json echo (json_encode($response)); } else{ $response['success'] = 0; //convert array to json echo (json_encode($response)); } } ?>
true
c1f718ee69329ea1e8fc4f273cb1399b78aebf1c
PHP
dicephp/types
/src/Arr.php
UTF-8
10,397
3.421875
3
[ "MIT" ]
permissive
<?php namespace Dice\Types; /** * Arr: A near-natural Array Implementation */ class Arr extends \ArrayIterator { /** @var array Original value with which the class was created */ protected $originalValue; /** @var int Active value, used for chaining */ protected $activeValue; /** @var bool Should all elements in the array be of the same type? */ protected $isStrict = false; /** @var string If the strict mode is set to true, then this string contains the type! */ protected $strictTypeName = 'builtIn:string'; /** @var mixed Return this value when an offset is not found */ protected $returnValueOnKeyNotFound = null; // ========== PROPERTIES FOR INTERFACES ========== /** @var int Internal position for Seekable interface */ private $position; /** * Arr constructor. * @param mixed $origValue Original value with which the object is to be constructed * @param bool $isStrict Should the values of this array be of the same type? * @param null|mixed $returnValueOnKeyNotFound Return this type of value if index for the array is not found * @throws \Exception */ public function __construct($origValue, bool $isStrict = false, $returnValueOnKeyNotFound = null) { // If strict mode, detect type and set it if ($isStrict) { $this->isStrict = true; $this->strictTypeName = $this->detectType($origValue); if ($this->strictTypeName == Constants::Array && count($origValue) > 1 && $this->strictTypeCheckForArrayElements($origValue) == false) { // Array types are not strictly the same throw new \Exception('Cannot construct a new ' . get_class($this) . ' using an array containing different types of elements'); } } $this->originalValue = $origValue; if ($this->detectType($origValue) != Constants::Array) { $this->activeValue = [$origValue]; } else { $this->activeValue = $origValue; } $this->returnValueOnKeyNotFound = $returnValueOnKeyNotFound; } /** * Static form of constructor * * @param array $origValue * @return Arr * @throws \Exception */ public static function create($origValue) { try { $arr = new Arr($origValue); } catch (\Exception $exception) { throw new $exception; } return $arr; } /** * String representation of the array (converted to JSON) * @return String returns the active text */ public function __toString() { return json_encode($this->activeValue); } /** * Alias of the count function */ public function length() { return $this->count(); } /** * Puts an item at the end of the array for numeric indexes. * * Use addIndexedItem method to add an item with an index. * * @param mixed $item Item to be pushed to the array */ public function append($item) { array_push($this->activeValue, $item); } /** * Puts an item at the end of the array for numeric indexes. * * Use addIndexedItem method to add an item with an index. * * @param mixed $item Item to be pushed to the array * @throws Exception\InvalidTypeException */ public function prepend($item) { if (is_resource($item)) { throw new Exception\InvalidTypeException('You cannot add a resource to an array.'); } if (is_array($item)) { throw new Exception\InvalidTypeException('You cannot prepend an array to an array as of now.'); } array_unshift($this->activeValue, $item); } /** * Returns the JSON representation of the original data * * @return Str */ public function jsonEncode() { return json_encode($this->activeValue); } /** * @param string $index The array index to be used when setting the item * @param mixed $item Item to be pushed to the array */ public function addIndexedItem($index, $item) { $this->activeValue[$index] = $item; } // ==================================================================== // NOTE: IMPLEMENTATION OF ArrayAccess INTERFACE METHODS // ==================================================================== /** * @inheritdoc */ public function offsetSet($offset, $value) { if ($this->isStrict && $this->detectType($value) != $this->strictTypeName) { throw new \Exception('Cannot set value of type ' . $this->detectType($value) . ' on an Arr object with strict type ' . $this->strictTypeName); } if (is_null($offset)) { $this->activeValue[] = $value; } else { $this->activeValue[$offset] = $value; } } /** * @inheritdoc */ public function offsetExists($offset) { return isset($this->activeValue[$offset]); } /** * @inheritdoc */ public function offsetUnset($offset) { unset($this->activeValue[$offset]); } /** * @inheritdoc */ public function offsetGet($offset) { $valToProcess = $this->returnValueOnKeyNotFound; if (isset($this->activeValue[$offset])) { // Value for given offset is there $valToProcess = $this->activeValue[$offset]; } if (is_array($valToProcess)) { $valToProcess = Arr::create($valToProcess); } // Value for given offset is NOT there return $valToProcess; } // ==================================================================== // NOTE: IMPLEMENTATION OF ArrayAccess INTERFACE METHODS ENDS HERE // ==================================================================== // ==================================================================== // NOTE: IMPLEMENTATION OF Countable INTERFACE METHODS // ==================================================================== /** * @return int Number of items in the array */ public function count() { return count($this->activeValue); } // ==================================================================== // NOTE: IMPLEMENTATION OF Countable INTERFACE METHODS ENDS HERE // ==================================================================== // ==================================================================== // NOTE: IMPLEMENTATION OF Seekable INTERFACE METHODS // ==================================================================== /** * @inheritdoc */ public function current() { return $this->activeValue[$this->position]; } /** * @inheritdoc */ public function next() { ++$this->position; } /** * @inheritdoc */ public function key() { return $this->position; } /** * @inheritdoc */ public function valid() { return isset($this->activeValue[$this->position]); } /** * @inheritdoc */ public function rewind() { $this->position = 0; } /** * @inheritdoc */ public function seek($position) { if (!isset($this->activeValue[$position])) { throw new \OutOfBoundsException("invalid seek position ($position)"); } $this->position = $position; } // ==================================================================== // NOTE: IMPLEMENTATION OF Seekable INTERFACE METHODS ENDS HERE // ==================================================================== // ==================================================================== // NOTE: IMPLEMENTATION OF Countable INTERFACE METHODS // ==================================================================== /** * @inheritdoc */ public function serialize() { return serialize($this->activeValue); } /** * @inheritdoc */ public function unserialize($serialized) { $this->activeValue = unserialize($serialized); } // ==================================================================== // NOTE: IMPLEMENTATION OF INTERFACE METHODS ENDS HERE // ==================================================================== // ==================================================================== // PRIVATE METHODS // ==================================================================== /** * Returns the type of a value as detected * * @param mixed $val Value to be checked * @return string The type (from the constants class) */ private function detectType($val) { // TODO: Complete the logic if (is_string($val)) { if (is_callable($val)) { return (Constants::TypeCallable); } return (Constants::String); } elseif (is_numeric($val) && is_int($val)) { return (Constants::Integer); } elseif (is_numeric($val) && is_float($val)) { // Double and Float are same in PHP return (Constants::Float); } elseif (is_bool($val)) { return (Constants::Bool); } elseif (is_array($val)) { return (Constants::Array); } elseif (is_callable($val) && get_class($val) == 'Closure') { return (Constants::TypeClosure); } else { // It must be an object return ('Class:' . get_class($val)); } } /** * Performs the type check on all elements of an array and tells if all the elements of the array are of same type * * @param array $arr The array to test * @return bool Whether all types were same or not */ private function strictTypeCheckForArrayElements(array $arr) { $firstType = null; foreach ($arr as $item) { if ($firstType == null) { $firstType = $this->detectType($item); } else { if ($firstType != $this->detectType($item)) { return false; } } } return true; } }
true
a018b6f71fd9d4c94aa7b21375726b2b5d71bc3a
PHP
sudrajadsasmita/rumahrahileducation
/application/models/Siswa_model.php
UTF-8
5,425
2.5625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
<?php defined('BASEPATH') or exit('No direct script access allowed'); /** * * Model Siswa_model * * This Model for ... * * @package CodeIgniter * @category Model * @author Setiawan Jodi <jodisetiawan@fisip-untirta.ac.id> * @link https://github.com/setdjod/myci-extension/ * @param ... * @return ... * */ class Siswa_model extends CI_Model { // ------------------------------------------------------------------------ var $column_order = [null, 'nama', 'jenjang_name', 'kelas_name', 'jurusan', 'sekolah', 'alamat', 'email']; var $column_search = ['nama', 'tb_jenjang.nama_jenjang', 'tb_kelas.nama_kelas', 'sekolah', 'alamat', 'email']; var $order = ['id_siswa_profile' => 'asc']; // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ public function _getDataTablesQuery() { $this->db->select("tb_siswa_profile.*, tb_jenjang.nama_jenjang as jenjang_name, tb_kelas.nama_kelas as kelas_name"); $this->db->from("tb_siswa_profile"); $this->db->join("tb_jenjang", "tb_jenjang.id_jenjang = tb_siswa_profile.jenjang_id"); $this->db->join("tb_kelas", "tb_kelas.id_kelas = tb_siswa_profile.kelas_id"); $i = 0; foreach ($this->column_search as $item) { if (@$_POST['search']['value']) { if ($i == 0) { $this->db->group_start(); $this->db->like($item, $_POST['search']['value']); } else { $this->db->or_like($item, $_POST['search']['value']); } if (count($this->column_search) - 1 == $i) { $this->db->group_end(); } } $i++; } if (isset($_POST['order'])) { $this->db->order_by($this->column_order[$_POST['order']['0']['column']], $_POST['order']['0']['dir']); } elseif (isset($this->order)) { $order = $this->order; $this->db->order_by(key($order), $order[key($order)]); } } public function getDataTables() { $this->_getDataTablesQuery(); if (@$_POST['length'] != -1) $this->db->limit(@$_POST['length'], @$_POST['start']); $query = $this->db->get(); return $query->result(); } public function countFiltered() { $this->_getDataTablesQuery(); $query = $this->db->get(); return $query->num_rows(); } public function countAll() { $this->db->from('tb_siswa_profile'); return $this->db->count_all_results(); } public function get($id = null) { $this->db->from('tb_siswa_profile'); if ($id != null) { $this->db->where('id_siswa_profile', $id); } $query = $this->db->get(); return $query; } public function getSiswa($siswa_profile_id) { $this->db->where('id_siswa_profile', $siswa_profile_id); $query = $this->db->get('tb_siswa_profile')->result(); return $query; } public function login($post) { $this->db->select('*'); $this->db->from('tb_siswa_profile'); $this->db->join('tb_jenjang', 'tb_jenjang.id_jenjang = tb_siswa_profile.jenjang_id'); $this->db->join('tb_kelas', 'tb_kelas.id_kelas = tb_siswa_profile.kelas_id'); $this->db->where('username', $post['username']); $this->db->where('password', sha1($post['password'])); $query = $this->db->get(); return $query; } public function create($post) { $params['id_siswa_profile'] = htmlspecialchars($post['id_siswa_profile']); $params['nama'] = htmlspecialchars($post['nama']); $params['username'] = htmlspecialchars($post['username']); $params['jenjang_id'] = htmlspecialchars($post['jenjang_id']); $params['kelas_id'] = $post['kelas_id']; $params['jurusan'] = htmlspecialchars($post['jurusan']); $params['sekolah'] = htmlspecialchars($post['sekolah']); $params['alamat'] = htmlspecialchars($post['alamat']); $params['email'] = htmlspecialchars($post['email']); $params['password'] = sha1($post['password1']); $params['image'] = htmlspecialchars($post['image']); $this->db->insert('tb_siswa_profile', $params); return $this->db->affected_rows(); } public function update($post) { $params['nama'] = htmlspecialchars($post['nama']); $params['username'] = htmlspecialchars($post['username']); $params['jenjang_id'] = htmlspecialchars($post['jenjang_id']); $params['kelas_id'] = htmlspecialchars($post['kelas_id']); $params['jurusan'] = htmlspecialchars($post['jurusan']); $params['sekolah'] = htmlspecialchars($post['sekolah']); $params['alamat'] = htmlspecialchars($post['alamat']); $params['email'] = htmlspecialchars($post['email']); if (!empty($post['password1'])) { $params['password'] = sha1($post['password1']); } if ($post['image'] != null) { $params['image'] = htmlspecialchars($post['image']); } $params['updated'] = date('Y-m-d H:i:s'); $this->db->where('id_siswa_profile', $post['id_siswa']); $this->db->update('tb_siswa_profile', $params); return $this->db->affected_rows(); } public function delete($id) { $this->db->where('id_siswa_profile', $id); $this->db->delete('tb_siswa_profile'); return $this->db->affected_rows(); } // ------------------------------------------------------------------------ } /* End of file Siswa_model.php */ /* Location: ./application/models/Siswa_model.php */
true
5a35e2e170086fe4d89a5bfaebc3bc8c98dd5435
PHP
lucaslz/tp-sismas-distribuidos
/src/App.php
UTF-8
1,322
3.234375
3
[]
no_license
<?php namespace app; use Pimple\Container; /** * Classe responsabel por gerenciar as configuracoes basicas da aplicacao, * como o gerenciado de dependencia as blibiotecas baixadas pelo composer * * @author Lucas Lima <lucasdevelopmaster@gmail.com> */ class App { /** * Configuracoes basicas * * @var array */ private $settings; /** * Injecao de dependencia * * @var Pimple\Container; */ private $container; /** * Construtor padrao da classe * * @param array $settings */ public function __construct($settings = []) { if (!empty($settings)) { $this->setSettings($settings); } if (is_array($this->getSettings())) { $this->container = new Container($this->getSettings()); } } /** * Busca o array de configuracoes */ public function getSettings() { return $this->settings; } /** * Seta o array de configuracoes * * @return self */ public function setSettings($settings) { $this->settings = $settings; return $this; } /** * Retorna o gerenciador de dependencias * * @return Pimple\Container; */ public function getContainer() { return $this->container; } }
true
81e4a2560e093538cd07ff3c15f6333dd664ce40
PHP
Cristovao-bit/exercicio_php
/06-exercicio.php
UTF-8
1,385
3.765625
4
[]
no_license
<!DOCTYPE> <html> <head> <meta charset="utf8"/> <title>Exercício 06</title> <style> input { padding: 10px; margin: 2px; } </style> </head> <body> <?php /* * Faça um algoritmo PHP que receba os valores A e B, imprima-os em ordem * crescente em relação aos seus valores. Ex: para A=5, B=4. Você deve imprimir * na tela: "4 5". */ if(isset($_POST['imprimir'])): $valor1 = $_POST['valor1']; $valor2 = $_POST['valor2']; $result = ""; if($valor1 < $valor2): $result = $valor1 . " " . $valor2; else: $result = $valor2 . " " . $valor1; endif; echo $result; endif; ?> <form method="POST"> <h2>Ordem crescente: <?= $result; ?></h2> <label> Valor 01: <input type="text" name="valor1"/> </label> <br> <br> <label> Valor 02: <input type="text" name="valor2"/> </label> <input type="submit" name="imprimir" value="Imprimir"/> </form> </body> </html>
true
f8cbd5d4aab205a58a301f078f6e6d02a7f560ee
PHP
Auriaz/fzn
/src/FileManager/PhotoFileManager.php
UTF-8
3,823
2.796875
3
[]
no_license
<?php namespace App\FileManager; use App\Entity\FileManager; use App\Service\UploaderHelper; use League\Flysystem\FileNotFoundException; use League\Flysystem\FilesystemInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\UploadedFile; class PhotoFileManager { const IMAGE = 'images'; const ARTICLE_IMAGE = 'article_image'; const ANIMAL_IMAGE = 'animal_image'; private $uploaderHelper; private $filesystem; private $logger; public function __construct(FilesystemInterface $publicUploadsFilesystem, UploaderHelper $uploaderHelper, LoggerInterface $logger) { $this->uploaderHelper = $uploaderHelper; $this->filesystem = $publicUploadsFilesystem; $this->logger = $logger; } public function uploadArticleImage(File $file, ?string $existingFilename): string { $newFilename = $this->uploadImage($file, self::ARTICLE_IMAGE, true); if ($existingFilename) { try { $result = $this->filesystem->delete(self::ARTICLE_IMAGE . '/' . $existingFilename); if ($result === false) { throw new \Exception(sprintf('Could not delete old uploaded file "%s"', $existingFilename)); } } catch (FileNotFoundException $e) { $this->logger->alert(sprintf('Old uploaded file "%s" was missing when trying to delete', $existingFilename)); } } return $newFilename; } public function uploadAnimalImage(File $file, ?string $existingFilename): string { $newFilename = $this->uploadImage($file, self::ANIMAL_IMAGE, true); if ($existingFilename) { try { $result = $this->filesystem->delete(self::ANIMAL_IMAGE . '/' . $existingFilename); if ($result === false) { throw new \Exception(sprintf('Could not delete old uploaded file "%s"', $existingFilename)); } } catch (FileNotFoundException $e) { $this->logger->alert(sprintf('Old uploaded file "%s" was missing when trying to delete', $existingFilename)); } } return $newFilename; } public function uploadArticleReference(File $file, ?string $existingFilename = null): string { $newFilename = $this->uploadImage($file, null, true); if ($existingFilename) { try { $result = $this->uploaderHelper->deleteFile(self::IMAGE . '/' . $existingFilename, true); if ($result === false) { throw new \Exception(sprintf('Could not delete old uploaded file "%s"', $existingFilename)); } } catch (FileNotFoundException $e) { $this->logger->alert(sprintf('Old uploaded file "%s" was missing when trying to delete', $existingFilename)); } } return $newFilename; } public function uploadImage(File $file, string $directory = null, bool $isPublic = true) { if($directory) { $directory = self::IMAGE.'/'.$directory; } else { $directory = self::IMAGE; } return $this->uploaderHelper->uploadFile($file, $directory, $isPublic); } public function getPublicPathPhoto(FileManager $file): string { return $this->uploaderHelper->getPublicPath(self::IMAGE.'/'.$file->getFilename()); } public function deletePhoto(string $filename, bool $isPublic = true): void { $this->uploaderHelper->deleteFile(self::IMAGE . '/' . $filename, $isPublic); } public function readStream(FileManager $file, bool $isPublic = true) { return self::IMAGE . '/' . $file->getFilename(); } }
true
0de4e9d0bcbdd3cda6e697ab75b35557c44067ae
PHP
TadasJ/kudos
/src/DataDog/UserBundle/Controller/TeamController.php
UTF-8
5,408
2.609375
3
[]
no_license
<?php namespace DataDog\UserBundle\Controller; use DataDog\UserBundle\Entity\Team; use DataDog\UserBundle\Entity\User; use DataDog\UserBundle\Form\Type\TeamType; use Symfony\Component\HttpFoundation\Request; use Doctrine\DBAL\DBALException; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use DateTime; /** * Team controller. * * @Route("/") */ class TeamController extends Controller { /** * Displays information of a single team * @Route("/team/view/{id}", name = "team_view") */ public function viewAction($id){ $em = $this->getDoctrine()->getManager(); $team = $em->getRepository('UserBundle:Team')->find($id); if(!$team){ throw $this->createNotFoundException('Team entity with ID: '.$id.' does not exist.'); } if($this->getUser()->getRole()->getRole() === 'ROLE_EMPLOYEE') { $found = false; foreach ($team->getUsers() as $user) { if ($user === $this->getUser()) { $found = true; break; } } if(!$found) { throw $this->createAccessDeniedException('You do not have permission to view this team.'); } } return $this->render('UserBundle:Team:view.html.twig', [ 'team' => $team, ]); } /** * Displays list of teams, individual for each user type. * @Route("/team", name = "team_index") */ public function indexAction(){ $user = $this->getUser(); if($user->getRole()->getRole() === 'ROLE_EMPLOYEE'){ $teams = $user->getTeams(); }else if($user->getRole()->getRole() === 'ROLE_MANAGER'){ $teams = $user->getManagedTeams(); }else if($user->getRole()->getRole() === 'ROLE_ADMIN'){ $em = $this->getDoctrine()->getManager(); $teams = $em->getRepository('UserBundle:Team')->findAll(); }else{ $teams = null; } return $this->render('UserBundle:Team:table.html.twig', [ 'teams' => $teams, ]); } /** * Responsible for creating new Team entries * * @Route("/team/create", name = "team_create") * @param Request $request * @Template("UserBundle:Team:create.html.twig") */ public function createAction(Request $request){ $em = $this->getDoctrine()->getManager(); $team = new Team(); $form = $this->createForm(new TeamType($em), $team); $form->handleRequest($request); if($form->isValid()){ $team = $form->getData(); //$user->setUsername($form->getData()->getUsername()); //$user->setPassword($form->getData()->getPassword()); //$user->setRole($form->getData()->getRole()); //$user->setFirstName($form->getData()->getFirstName()); //$user->setLastName($form->getData()->getLastName()); //$user->setTotalPoints($form->getData()->getTotalPoints()); //$user->setIsActive($form->getData()->getIsActive()); $em->persist($team); $em->flush(); $this->get('session')->getFlashBag()->add('success', 'Team '.$team->getName().' successfully created.'); return $this->redirectToRoute('team_index'); } return $this->render('UserBundle:Team:create.html.twig', [ 'form' => $form->createView(), 'team' => $team, ]); } /** * Responsible for editing Tean entries * * @Route("/team/edit/{id}", name = "team_edit") * @param Request $request * @Template("UserBundle:Team:edit.html.twig") */ public function editAction(Request $request, $id){ $em = $this->getDoctrine()->getManager(); $team = $em->getRepository('UserBundle:Team')->find($id); if(!$team){ throw $this->createNotFoundException('User entity with ID: '.$id.' does not exist.'); } $form = $this->createForm(new TeamType($em), $team); if($request->getMethod() === 'POST') { $form->handleRequest($request); if ($form->isValid()) { $team = $form->getData(); //$user->setUsername($form->getData()->getUsername()); //$user->setPassword($form->getData()->getPassword()); //$user->setRole($form->getData()->getRole()); //$user->setFirstName($form->getData()->getFirstName()); //$user->setLastName($form->getData()->getLastName()); //$user->setTotalPoints($form->getData()->getTotalPoints()); //$user->setIsActive($form->getData()->getIsActive()); $date = new DateTime(); $team->setUpdateAt($date->setTimestamp(time())); $em->persist($team); $em->flush(); $this->get('session')->getFlashBag()->add('success', 'Team ' . $team->getName() . ' successfully updated.'); return $this->redirectToRoute('team_index'); } } return $this->render('UserBundle:Team:edit.html.twig', [ 'form' => $form->createView(), 'user' => $team, ]); } }
true
6b755967750aa7c0252ea789f496b693010ef3bd
PHP
CharulBhanawat13/CRM
/SmartFreezer/db_connection.php
UTF-8
390
2.609375
3
[]
no_license
<?php function OpenCon() { $dbhost = "localhost"; // $dbuser = "pyrotech_BBR"; // $dbpass = "Pyrotech@123"; // $db = "pyrotech_bbr"; $dbuser="root"; $dbpass="test@123"; $db="test"; $conn = new mysqli($dbhost, $dbuser, $dbpass, $db) or die("Connect failed: %s\n" . $conn->connect_error); return $conn; } function CloseCon($conn) { $conn->close(); } ?>
true
b15fabdec4113e6474d938d61ffa0c99ac92a4f3
PHP
ngodinhloc/jennifer
/src/Http/Response.php
UTF-8
524
2.8125
3
[]
no_license
<?php namespace Jennifer\Http; use Jennifer\Com\Common; class Response { /** * Redirect to another view with para * @param string $url requires full /module/view/ * @param array $paras */ public function redirect($url, $paras = []) { $str = Common::arrayToParas($paras); Common::redirectTo($url . $str); } /** * @param $message * @param $code */ public function error($message, $code) { die("Error code {$code}: {$message}"); } }
true
14887e7b02d261359fc086b6f3ebf2e442459e41
PHP
RomanRabirokh/ImageRandSearch
/src/app/classes/YandexSearch.php
UTF-8
1,882
2.84375
3
[]
no_license
<?php namespace classes; use interfaces\ImageSearch; /** * Class YandexSearch * @package classes */ class YandexSearch implements ImageSearch { /** * @param string $searchText * @param int $number * @return string */ public function getImage(string $searchText, int $number): string { $url= 'https://yandex.ua/images/search'; $params['text'] = $this->codeUrl($searchText); $params['size']= 'large'; // без защиты $params['ncrnd']='0.143474640968911'; var_dump($url. $this->parseUrl($params)); if ($curl = curl_init()) { curl_setopt($curl, CURLOPT_URL, $url . $this->parseUrl($params)); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); $out = curl_exec($curl); if ($errno = curl_errno($curl)) { $error_message = curl_strerror($errno); Application::getLogErrors()->saveLog("cURL error ({$errno}):\n {$error_message}"); echo "cURL error ({$errno}):\n {$error_message}"; } curl_close($curl); //return json_decode($out, true)['items'][0]['link']; } file_put_contents('site.html', $out); die; } /** * @param $text * @return string */ protected function codeUrl($text) { return urlencode($text); } /** * @param $params * @return string */ protected function parseUrl($params) { $str = ''; foreach ($params as $key => $param) { if (empty($str)) { $str .= "?$key=$param"; } else { $str .= "&$key=$param"; } } return $str; } }
true
b86c49856d23d04d4f7538ea77c9b6a121481e1c
PHP
cui2018/crwy_client
/gm/k/lib/excel.php
UTF-8
3,193
2.90625
3
[]
no_license
<?php /* * Excel类 * @Package Name: Excel * @Author: Keboy xolox@163.com * @Modifications:No20170629 * */ class Excel { public $sheets = array(TRUE); public function __construct() { require_once('./k/package/phpexcel/PHPExcel.php'); $this->phpexcel = new PHPExcel(); require_once('./k/package/phpexcel/PHPExcel/IOFactory.php'); $this->reader = \PHPExcel_IOFactory::createReader('Excel2007'); } public function read($file) { $this->excel = $this->reader->load($file); return $this; } public function getSheet($index = 0) { $sheet = $this->excel->getSheet($index); $rows = $sheet->getHighestRow(); $columns = $sheet->getHighestColumn(); $columns = PHPExcel_Cell::columnIndexFromString($columns); $columnName = array(); for ( $i = 0; $i < $columns; $i++ ) { $columnName[] = PHPExcel_Cell::stringFromColumnIndex($i); } $data = array(); for ( $i = 1; $i <= $rows; $i++ ) { $row = array(); for ( $j = 0; $j < $columns; $j++ ) { $value = $sheet->getCellByColumnAndRow($j,$i)->getValue(); if ( $value != NULL ) $row[$columnName[$j]] = $value; else break; } if ( $row ) $data[] = $row; else break; } return $data; } public function setSheet($index = 0,$name = '',$data = array(),$title = array()) { if ( array_isset($this->sheets,$index) ) $sheet = $this->phpexcel->getSheet($index); else { $this->phpexcel->createSheet($index); $sheet = $this->phpexcel->getSheet($index); } $this->sheets[$index] = $sheet; $row = 1; if ( $title ) { $col = 0; foreach ($title as $value => $width) { $sheet->getColumnDimensionByColumn($col)->setWidth($width); $sheet->setCellValueByColumnAndRow($col,$row,$value); $style = $sheet->getStyleByColumnAndRow($col,$row); $style->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER)->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); $style->getFont()->setSize(12)->setBold(TRUE)->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE); $style->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF006699'); $borders = $style->getBorders(); $borders->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN)->getColor()->setARGB('FFFFFFFF'); $borders->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN)->getColor()->setARGB('FFFFFFFF'); $borders->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN)->getColor()->setARGB('FFFFFFFF'); $borders->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN)->getColor()->setARGB('FFFFFFFF'); $col++; } $sheet->getRowDimension(1)->setRowHeight(21); $row++; } foreach ($data as $line) { $col = 0; foreach ($line as $value) { $sheet->setCellValueByColumnAndRow($col,$row,$value); $col++; } $row++; } $sheet->setTitle($name); return $this; } public function download($name,$mode = 'Excel5') { @ob_clean(); $this->phpexcel->setActiveSheetIndex(0); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="' . $name . '"'); PHPExcel_IOFactory::createWriter($this->phpexcel,$mode)->save('php://output'); } }
true
302d25d256045a8732af8e5ef59ceb926b37d487
PHP
anyulled/MercadoMotor
/includes/noticia.php
UTF-8
2,701
2.53125
3
[]
no_license
<?php /** * Description of noticia * * @author Anyul Rivas */ class noticia extends db { function crear($datos, $imagenes) { $imagen = new SimpleImage(); $result = $this->insert("noticia", $datos); if ($result['suceed']) { foreach ($imagenes as $indice => $noticia_imagen) { if ($noticia_imagen['error'] == 0) { $nombre_imagen = "noticia-" . $result['insert_id'] . "-" . $indice . ".jpg"; $exito = Misc::mover_imagen($noticia_imagen['tmp_name'], $nombre_imagen); if ($exito) { $resultado = $this->insert("imagen_noticia", array( "url" => $nombre_imagen, "noticia_id" => $result['insert_id'])); } } } } else { return $result; } return $result; } function editar($datos, $imagenes, $id) { $result = $this->update("noticia", $datos, array("id" => $id)); if ($result['suceed']) { foreach ($imagenes as $indice => $noticia_imagen) { if ($noticia_imagen['error'] == UPLOAD_ERR_OK) { $nombre_imagen = "noticia-" . $id . "-" . $indice . ".jpg"; $exito = Misc::mover_imagen($noticia_imagen['tmp_name'], $nombre_imagen); if ($exito) { $resultado = $this->insert("imagen_noticia", array( "url" => $nombre_imagen, "noticia_id" => $id)); } } } } return $result; } function eliminar($id) { $this->delete("imagen_noticia", array("noticia_id" => $id)); return $this->delete("noticia", array("id" => $id)); } function ver($id) { $dato = array(); $noticia_temp = $this->select("*", "noticia", array("id" => $id)); $imagen_temp = $this->select("*", "imagen_noticia", array("noticia_id" => $id)); if (!empty($noticia_temp['data'])) { $dato['noticia'] = $noticia_temp['data'][0]; $dato['imagenes'] = $imagen_temp['data']; } return $dato; } function eliminar_imagen($id) { return $this->delete("imagen_noticia", array("id" => $id)); } function listar($limite = 3){ return $this->dame_query("select noticia.*, (select min(url) from imagen_noticia where noticia_id = noticia.id) imagen from noticia where status = 1 order by id desc LIMIT $limite"); } } ?>
true
85ac7cbceaf40099d4706dd4ad97d045757d453c
PHP
peter-gribanov/SpecificationPattern
/src/AndSpecification.php
UTF-8
710
2.9375
3
[]
no_license
<?php namespace Mbrevda\SpecificationPattern; use \Mbrevda\SpecificationPattern\SpecificationInterface; use \Mbrevda\SpecificationPattern\CompositeSpecification; class AndSpecification extends CompositeSpecification { private $specification1; private $specification2; public function __construct( SpecificationInterface $specification1, SpecificationInterface $specification2 ) { $this->specification1 = $specification1; $this->specification2 = $specification2; } public function isSatisfiedBy($candidate) { return $this->specification1->isSatisfiedBy($candidate) && $this->specification2->isSatisfiedBy($candidate); } }
true
bc09604eb3c08ce7ea3514655e29565d34302203
PHP
cnralux/EDTF
/tests/Unit/FactoryTrait.php
UTF-8
1,050
2.6875
3
[]
no_license
<?php /** @noinspection PhpIncompatibleReturnTypeInspection */ /** @psalm-suppress all */ declare(strict_types=1); namespace EDTF\Tests\Unit; use EDTF\Model\ExtDate; use EDTF\Model\ExtDateTime; use EDTF\Model\Interval; use EDTF\PackagePrivate\Parser\Parser; use EDTF\Model\Season; use EDTF\Model\Set; /** * @todo Remove this class after library become stable */ trait FactoryTrait { public function createExtDate(string $data): ExtDate { return $this->parse($data); } public function createExtDateTime(string $data): ExtDateTime { return $this->parse($data); } public function createInterval(string $data): Interval { return $this->parse($data); } public function createSeason(string $data): Season { return $this->parse($data); } public function createSet(string $data): Set { return $this->parse($data); } private function parse($data): object { $parser = new Parser(); return $parser->createEdtf($data); } }
true
ea9cd316765b8da58f895847caa0f0d3915bf7f8
PHP
AlbertSadykovOfficial/WEB_LESSONS
/lessons/PHP/info.php
UTF-8
5,306
3.3125
3
[]
no_license
<?php // Вывод всей полезной информации //phpinfo(); //phpversion(); /* Конструкции once - Позволяют: исклбчить повторений и ошибко из-за них Пример: вкл Библиотеки: library1.php library2.php 2 - содержит 1ю, чтобы не было ошибок в связи с эти-> Интерпретатор игнорирует уже присущий код require - как и include , НО include-открывает файл Один раз, а если ошибка, то ему пофиг, А require - будет пытаться открыть файл все время */ include_once "dope/header.html"; echo 'main info'; require_once "dope/footer.html"; /* Проверяет есть ли такая функции в библиотеке function_exists("func"); */ echo function_exists("array_combine"); // TRUE - Func есть echo '<hr>'; /* print_r($object); - Выведет всю информацию класса clone Позволяет склонировать класс, иначе создать обьект с разными свойствами не получится, т.к obj1 и obj2 ссылаются на один и тот же объект */ $object1 = new User(); $object1->name = "Alice"; $object2 = $object1; $object2->name = "Amy"; echo "object1 name = " . $object1->name . "<br>"; echo "object2 name = " . $object2->name . "<br>"; $object1 = new User(); $object1->name = "Alice"; $object2 = clone $object1; $object2->name = "Amy"; echo "object1 name = " . $object1->name . "<br>"; echo "object2 name = " . $object2->name . "<br>"; class User { public $name;} /* Статические функции + константы User::pwd_string(); // (::), при (->) Будет ошибка class User { const PASSWORD = 111; static function pwd_string() { echo "Пожалуйста, введите свой пароль,иначе пароль:<br>"; echo self::PASSWORD; // self::(Обращение к константам и стат переменным напрямую) } } */ /* Неявное обьявление свойства (не надо так делать) Даже если в классе не сущетсвует св-ва, его можно добавить: $object1 = new User(); $object1->name = "Alice"; echo $object1->name; class User {} */ /* class Example { public $age = 23; // Открытое свойство (видно всем) protected $usercount; // Защищенное свойство (передается дочерним классам) private function admin() // Закрытый метод (есть только у объекта этого класса) { //code } } */ echo "<br><hr>"; /* Методы наследования При наследовании классов, если в дочернем классе есть метод, который назван так же, как и в Родит, то дочерн класс перезапишет его, чтобы получить доступ к Родительскому методу, нужно использовать инструкцию parent::method(); ? Если нужно использовать вызов одноименного метода из текущего класса, можно исп инструкцию self::method(); Запретить перезапись метода можно, использовав слово final class User { final function copyright() {echo "Этот класс был создан Джо Смитом ";} } */ $object = new Son; $object->test(); $object->test2(); class Dad { function test() { echo "[Class Dad] Я твой отец<br>"; } } class Son extends Dad { function test() { echo "[Class Son] ЛЮК <br>"; } function test2() { parent::test(); } } echo "<br><hr>"; /* __constructor При создании дочернего класса конструктор не сработает его нужно повторно обьявлять в дочернем классе */ $object = new Tiger(); echo "У тигров есть...<br>"; echo "Мех: " . $object->fur . "<br>"; echo "Полосы: " . $object->stripes; class Wildcat { public $fur; // У диких кошек есть мех function __construct() { $this->fur = "TRUE"; } } class Tiger extends Wildcat { public $stripes; // У тигров есть полосы function __construct() { parent::__construct(); // Первоочередной вызов родительского //конструктора $this->stripes = "TRUE"; } } ?>
true
8be649b91e3e9925e25c1d508402ab7254e3f4e1
PHP
thammons25/shopCart
/bar.php
UTF-8
578
2.796875
3
[]
no_license
<?php include './connect.php'; $sqlSelect = "SELECT id , name FROM categories"; $result = mysqli_query( $myConn , $sqlSelect ); if( !$result ) { echo "error( bar ) -> " . mysqli_error( $myConn ); } if( mysqli_num_rows( $result ) > 0 ) { echo "<strong>CATEGORIES</strong><br />"; while( $row = mysqli_fetch_assoc( $result ) ) { $catID = filter_var( $row["id"] , FILTER_VALIDATE_INT); $catName = filter_var( $row["name"] , FILTER_SANITIZE_STRING ); echo "<a href = './products.php?catID=" . $catID . "'>" . $catName . "</a>"; echo "<br />"; } } ?>
true
1f7d2761ad70c36b4e541ba329f582d549eeca2a
PHP
joey180x/todo-list
/index.php
UTF-8
2,862
2.640625
3
[]
no_license
<!DOCTYPE html> <html><!--opening html tag--> <head><!--header tag--> <title>Simple To-Do List</title><!--adding title for webpage in tab--> <link rel="stylesheet" href="css/main.css"><!--linking to main.css from css file--> </head><!--closing header tag--> <body><!--opening body tag--> <div class="wrap"><!--A wrapper is an element, commonly a div, that encloses one or more other elements in the HTML markup--> <div class="task-list"> <ul><!--opening unordered-list tag--> <?php require("includes/connect.php");//Requiring connect.php file to connect to database $mysqli = new mysqli('localhost', 'root', 'root', 'todo');//connecting to database $query = "SELECT * FROM tasks ORDER BY date ASC, time ASC";//query information, order by date and time if ($result = $mysqli->query($query)) {//if result is a query $numrows = $result->num_rows;//number of rows if ($numrows>0) {//if number of rows is gretaer than 0 while($row = $result->fetch_assoc()){//fetch associated $task_id = $row['id'];//task id $task_name = $row['task'];//and task name echo '<li> <span>'.$task_name. '</span> <img id="'.$task_id.'" class="delete-button" width="10px" src="images/close.svg"/> </li>'; } } } ?> </ul><!--closing ul tag--> </div><!--closing divider --> <form class="add-new-task" autocomplete="off"><!--adding new task, turning autocomplete off--> <input type="text" name="new-task" placeholder="Add new item.."/><!--new task--> </form><!--closing form tag--> </div><!--closing divider--> </body><!--closing html tag--> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script>//opening script tag add_task(); //calling the add task function function add_task(){//add task function $('.add-new-task').submit(function() {//add new task and submit var new_task = $('.add-new-task input [name=new-task').val(); if (new_task != '') {//if theres nothing $.post('includes/add-task.php', { task: new_task }, function(data) {//post add task. task new task. $('add-new-task input[name=new-task]').val();//add new task input $(data).appendTo('.task-list ul').hide().fadeIn();//variable data append to task list ul hide and fade in }); } return false;//return false }); } $('.delete-button').click(function(){//delete button function var current_element = $(this) = $(this); //variable this is the current element var task_id = $(this).attr('id');// method returns undefined for attributes that have not been set. $.post('includes/delete-task.php', {id: task_id}, function(){//post deleted task current_element.parent().fadeOut("fast", function(){//fade out fast when task is deleted $(this).remove();//remove this }); }); }); </script><!--closing script tag--> </html><!--closing html tag-->
true
454d69c596e6371b94d895989b1daddaaa556567
PHP
tehCh0nG/laravel-h-captcha
/src/HttpClient.php
UTF-8
997
2.953125
3
[ "MIT" ]
permissive
<?php namespace Buzz\LaravelHCaptcha; use Exception; use GuzzleHttp\Client; class HttpClient implements HttpClientContract { /** * Name of callback function * * @var Client $client */ public $client; public function __construct() { $this->initialHttpClient(); } /** * Initial http client via GuzzleHttp\Client */ protected function initialHttpClient() { $this->client = new Client(); } /** * Send post request and return array * * @param string $uri URI object or string. * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. * * @return array */ public function post($uri = '', array $options = []) { try { $response = $this->client->request('POST', $uri, $options); return json_decode($response->getBody(), true); } catch (Exception $exception) { return []; } } }
true
b98ba0beac1b89aff02e6f2228f426456e6e63b9
PHP
lazymanso/wechat
/src/Basic.php
UTF-8
2,770
2.796875
3
[ "MIT" ]
permissive
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ namespace lazymanso\wechat; use lazymanso\wechat\config\Command; /** * 一些基础的微信接口操作 */ class Basic extends Common { /** * 应用配置 * @var array */ protected $aConfig = [ 'appid' => '', 'secret' => '', ]; /** * 构造 * @param array $aConfig [in]应用配置,格式如下: * <pre> * array( * 'appid' => '', * 'secret' => '', * ) * </pre> */ public function __construct(array $aConfig = []) { if (!empty($aConfig)) { $this->aConfig = array_merge($this->aConfig, $aConfig); } $this->strAppid = $this->aConfig['appid']; $this->strSecret = $this->aConfig['secret']; } /** * 获取微信接口调用凭证 * @link https://developers.weixin.qq.com/miniprogram/dev/api/open-api/access-token/getAccessToken.html * @return false|array 返回false表示请求失败或出错 * <pre> * 成功时返回token信息 * access_token - string,获取到的凭证 * expires_in - int,凭证有效时间,单位:秒。目前是7200秒之内的值 * </pre> */ public function token() { $aParam = [ 'appid' => $this->strAppid, 'secret' => $this->strSecret, ]; return $this->doCommand(Command::BASE_ACCESS_TOKEN, $aParam); } /** * 检验数据的真实性,并且获取解密后的明文 * @param array $aInput [in]参数列表 * <pre> * appid - string,必填,小程序appid * session_key - string,必填,用户在小程序登录后获取的会话密钥 * encrypt_data - string,必填,加密的用户数据 * iv - string,必填,与用户数据一同返回的初始向量 * </pre> * @param array $aOutput [out]明文信息 * @return boolean */ protected function decryptData(array $aInput, array &$aOutput = []) { if (!$this->checkFields($aInput, ['appid', 'session_key', 'encrypt_data', 'iv'], [], true)) { return false; } if (strlen($aInput['session_key']) != 24) { $this->setError('encodingAesKey 非法!'); return false; } $aesKey = base64_decode($aInput['session_key']); if (strlen($aInput['iv']) != 24) { $this->setError('初始向量非法!'); return false; } $aesIV = base64_decode($aInput['iv']); $aesCipher = base64_decode($aInput['encrypt_data']); $result = openssl_decrypt($aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV); $aData = json_decode($result, true); if (empty($aData) || ($aData['watermark']['appid'] != $aInput['appid'])) { $this->setError('解密后得到的数据非法!解密数据:' . print_r($aInput, true)); return false; } $aOutput = $aData; return true; } }
true
551bd4ad50cc418766db30d3a54f4c715cb60c9d
PHP
rrbolton423/Android-App-Development-RESTful-Web-Services
/Assets/NadiaServices/xml/itemsfeed.php
UTF-8
1,050
2.90625
3
[]
no_license
<?php require_once('../database/itemsquery.php'); //Build array of data items $arRows = array(); while ($row = mysqli_fetch_assoc($rsItems)) { array_push($arRows, $row); } // build root XML element $itemsElement = new SimpleXMLElement('<items></items>'); // loop data and build data structure for ($i = 0; $i < count($arRows); $i++) { $itemElement = $itemsElement->addChild('item'); $itemRow = $arRows[$i]; $itemElement->addChild('itemName', $itemRow['itemName']); $itemElement->addChild('category', $itemRow['category']); $itemElement->addChild('description', $itemRow['description']); $itemElement->addChild('sort', $itemRow['sort']); $itemElement->addChild('price', $itemRow['price']); $itemElement->addChild('image', $itemRow['image']); } mysqli_free_result($rsItems); //format for pretty printing $dom = new DOMDocument('1.0', 'UTF-8'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($itemsElement->asXML()); //Send to browser header('Content-type: text/xml'); echo $dom->saveXML(); ?>
true
7096012e10b54d3f4bb36899f4e88a5d51b7baf5
PHP
CleverMonitor/SMTPAPI
/src/Methods/Groups.php
UTF-8
1,149
2.609375
3
[]
no_license
<?php namespace CleverMonitor\SmtpApi\Methods; use CleverMonitor\SmtpApi\Exceptions\NotImplementedException; /** * CleverMonitor Developers * * Transaction Message Groups * @author CleverMonitor <support@clevermonitor.com> */ class Groups extends Base { /** * Create group * @param string $name * @param string $description * @return \CleverMonitor\SmtpApi\Connection\Response * @deprecated Not Implemented * @throws NotImplementedException */ public function createGroup($name, $description = NULL) { throw new NotImplementedException(); } /** * Overview of groups * @param int $count * @param int $offset * @return \CleverMonitor\SmtpApi\Connection\Response * @deprecated Not Implemented * @throws NotImplementedException */ public function getOverview($count = 100, $offset = 0) { throw new NotImplementedException(); } /** * Delete group * @param string $code * @param string $move * @return \CleverMonitor\SmtpApi\Connection\Response * @deprecated Not Implemented * @throws NotImplementedException */ public function deleteGroup($code, $move = NULL) { throw new NotImplementedException(); } }
true
af063d201b3c11274e75cbbf509f26c8617a264a
PHP
AurelienPaulinoOggier/OnTheFly
/Vwijzigen.php
UTF-8
2,322
3
3
[]
no_license
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="styleOnTheFly.css"> <title> Wijzigen van Vliegtuig </title> </head> <body> <?php #wijzigen van vliegtuigen #database connectie $host = "localhost"; $dbname = "onthefly"; $username = "root"; $password = ""; $con = new PDO ("mysql:host=".$host.";dbname=".$dbname.";" ,$username, $password); $vid = $_GET['vid']; #terug naar vorige pagina if(isset($_POST{'btnTerug'})){ Header("location: OnTheFlyVligtuigen.php"); } #wijzigen if(isset($_POST['btnWijzigen'])) { $vnummer = $_POST['vnummer']; $vtype = $_POST['vtype']; $vmaatschappij = $_POST['vmaatschappij']; $vstatus = $_POST['vstatus']; $query = "UPDATE vliegtuigen SET vnummer = '$vnummer', vtype = '$vtype', vmaatschappij = '$vmaatschappij', vstatus = '$vstatus' WHERE vid = '$vid'"; $stm = $con->prepare($query); if($stm->execute()) { Header("location: OnTheFlyVligtuigen.php"); } } #query van wijzigen $query = "SELECT * FROM vliegtuigen WHERE vid = $vid"; $stm = $con->prepare($query); if($stm->execute()) { $res = $stm->fetch(PDO::FETCH_OBJ); ?> <form method="POST"> <div class = 'ToBx' style='margin-top:10%;'> <h1> Vliegtuig </h1><br/> <input type="text" style='margin-left:10%;' name="vnummer" value="<?php echo $res->vnummer; ?>" /><br/> <input type="text" style='margin-left:10%;' name="vtype" value="<?php echo $res->vtype; ?>" /><br/> <input type="text" style='margin-left:10%;' name="vmaatschappij" value="<?php echo $res->vmaatschappij; ?>" /><br/> <select name="vstatus" style='margin-left:10%;'> <option value="<?php echo $res->vstatus; ?>"><?php echo $res->vstatus; ?></option> <option value="normaal">normaal</option> <option value="grounded">grounded</option> <option value="in reparatie">in reparatie</option> <option value="verloren">verloren</option> </select><br/> <input type="submit" name="btnWijzigen" value="Wijzigen" style='margin-top:7%; margin-left:15%; width:200px;'/> <input type = "submit" name="btnTerug" value="terug" style='margin-top:3%; margin-left:15%; width:200px;'/> <div/> </form> <?php }else "werkt niet?!?" ?> </body> </html>
true
1e76791ada1827b2263f32124e3ae9b71ad20315
PHP
wbbim/dht
/www/php/lib/Autoloader.php
UTF-8
858
2.953125
3
[ "MIT" ]
permissive
<?php class Autoloader{ public static $dirs; public static function addDir($dir){ if (!isset(self::$dirs)) self::$dirs = array(); if (is_string($dir)){ self::$dirs[] = $dir; } else { self::$dirs = array_merge(self::$dirs, $dir); } } public static function loader($origin_class){ $class = trim(str_replace('\\', '/', $origin_class), '/'); $found = false; foreach (self::$dirs as $dir) { $class_file = $dir . '/' . $class . '.php'; if (file_exists($class_file)){ $found = true; break; } } if (!$found){ // do not throw exception for using both this autoloader and composer autoload return false; // throw new Exception("class {$origin_class} does not exist"); } include $class_file; } public static function registerAutoloader(){ spl_autoload_register(array('Autoloader', 'loader')); } }
true
323cb9d264de70e25a026eefa74f9e3fe7fae11e
PHP
Smart-Lines2021/SIREVA
/database/migrations/2014_10_11_000000_create_empresas_table.php
UTF-8
882
2.53125
3
[ "MIT" ]
permissive
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateEmpresasTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('empresas', function (Blueprint $table) { $table->id(); $table->string('razon_social',100); $table->string('domicilio',100)->nullable($value=true); $table->string('telefono',100)->nullable($value=true); $table->string('correo',100)->nullable($value=true); $table->boolean('activo')->default(1); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('empresas'); } }
true
45e9594f9755f2f53dddfc2e01ca8cdb1f3c6b76
PHP
Insight-Global/Sovern-PHP-SOAP-Client
/src/GetAccountInfo.php
UTF-8
626
2.8125
3
[]
no_license
<?php namespace Sovern; class GetAccountInfo { /** * @var GetAccountInfoRequest $request */ protected $request = null; /** * @param GetAccountInfoRequest $request */ public function __construct($request) { $this->request = $request; } /** * @return GetAccountInfoRequest */ public function getRequest() { return $this->request; } /** * @param GetAccountInfoRequest $request * @return \Sovern\GetAccountInfo */ public function setRequest($request) { $this->request = $request; return $this; } }
true
38f96c9f0ed0e206f9116347a09af32ba73ccdde
PHP
CommonApi/Fieldhandler
/ValidateResponseInterface.php
UTF-8
783
2.578125
3
[ "MIT" ]
permissive
<?php /** * Validate Response Interface * * @package Fieldhandler * @copyright 2014 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace CommonApi\Fieldhandler; /** * Validate Response Interface * * @package Fieldhandler * @license http://www.opensource.org/licenses/mit-license.html MIT License * @copyright 2014 Amy Stephen. All rights reserved. * @since 1.0.0 */ interface ValidateResponseInterface { /** * Get Validation Response * * @return Boolean * @since 1.0.0 */ public function getValidateResponse(); /** * Get Validation Messages * * @return array * @since 1.0.0 */ public function getValidateMessages(); }
true
897885edc9f8d45c9416056027ff2d1f9dc359bf
PHP
thebiggive/matchbot
/src/Application/Commands/RetrospectivelyMatch.php
UTF-8
4,487
2.703125
3
[]
no_license
<?php declare(strict_types=1); namespace MatchBot\Application\Commands; use DateTime; use MatchBot\Domain\DonationRepository; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Notifier\Bridge\Slack\Block\SlackHeaderBlock; use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock; use Symfony\Component\Notifier\Bridge\Slack\SlackOptions; use Symfony\Component\Notifier\ChatterInterface; use Symfony\Component\Notifier\Message\ChatMessage; /** * Find complete donations to matched campaigns with less matching than their full value, from the past N days * if specified, and allocate any newly-available match funds to them. * * If not argument (number of days) is given, campaigns which closed within the last hour are checked * and all of their donations are eligible for matching. */ class RetrospectivelyMatch extends LockingCommand { protected static $defaultName = 'matchbot:retrospectively-match'; public function __construct( private DonationRepository $donationRepository, private ChatterInterface $chatter, ) { parent::__construct(); } protected function configure(): void { $this->setDescription( "Allocates matching for just-closed campaigns' donations, or the " . "last N days' donations, if missed due to pending reservations, refunds etc." ); $this->addArgument( 'days-back', InputArgument::OPTIONAL, 'Number of days back to look for donations that could be matched.' ); } protected function doExecute(InputInterface $input, OutputInterface $output): int { if (!is_numeric($input->getArgument('days-back'))) { // Default mode is now to auto match for campaigns that *just* closed. $output->writeln('Automatically evaluating campaigns which closed in the past hour'); $oneHourAgo = (new DateTime('now'))->sub(new \DateInterval('PT1H')); $toCheckForMatching = $this->donationRepository ->findNotFullyMatchedToCampaignsWhichClosedSince($oneHourAgo); } else { // Allow + round non-whole day count. $daysBack = round((float) $input->getArgument('days-back')); $output->writeln("Looking at past $daysBack days' donations"); $sinceDate = (new DateTime('now'))->sub(new \DateInterval("P{$daysBack}D")); $toCheckForMatching = $this->donationRepository ->findRecentNotFullyMatchedToMatchCampaigns($sinceDate); } $numChecked = count($toCheckForMatching); $distinctCampaignIds = []; $numWithMatchingAllocated = 0; $totalNewMatching = '0.00'; foreach ($toCheckForMatching as $donation) { $amountAllocated = $this->donationRepository->allocateMatchFunds($donation); if (bccomp($amountAllocated, '0.00', 2) === 1) { $this->donationRepository->push($donation, false); $numWithMatchingAllocated++; $totalNewMatching = bcadd($totalNewMatching, $amountAllocated, 2); if (!in_array($donation->getCampaign()->getId(), $distinctCampaignIds, true)) { $distinctCampaignIds[] = $donation->getCampaign()->getId(); } } } $numDistinctCampaigns = count($distinctCampaignIds); $summary = "Retrospectively matched $numWithMatchingAllocated of $numChecked donations. " . "£$totalNewMatching total new matching, across $numDistinctCampaigns campaigns."; $output->writeln($summary); // If we did any new matching allocation, whether because of campaigns just closed or because // the command was run manually, send the results to Slack. if ($numDistinctCampaigns > 0) { $chatMessage = new ChatMessage('Retrospective matching'); $options = (new SlackOptions()) ->block((new SlackHeaderBlock(sprintf( '[%s] %s', getenv('APP_ENV'), 'Retrospective matching completed', )))) ->block((new SlackSectionBlock())->text($summary)); $chatMessage->options($options); $this->chatter->send($chatMessage); } return 0; } }
true
c27c8e3f6f1cdc8b7afe3849fa25062951072a79
PHP
heyday/heystack-ecommerce-core
/src/Locale/Interfaces/ZoneInterface.php
UTF-8
1,253
2.765625
3
[ "MIT" ]
permissive
<?php /** * This file is part of the Ecommerce-Core package * * @package Ecommerce-Core */ /** * Interfaces namespace */ namespace Heystack\Ecommerce\Locale\Interfaces; use Heystack\Core\Identifier\IdentifierInterface; /** * Defines what methods/functions a Zone class needs to implement * * @copyright Heyday * @package Ecommerce-Core */ interface ZoneInterface { /** * Returns a unique identifier * @return \Heystack\Core\Identifier\Identifier */ public function getIdentifier(); /** * Returns the name of the Zone object * @return string */ public function getName(); /** * @param IdentifierInterface $identifier * @return mixed */ public function addCountry(IdentifierInterface $identifier); /** * @param array $countries * @return mixed */ public function setCountries(array $countries); /** * @return mixed */ public function getCountries(); /** * @param IdentifierInterface $identifier * @return mixed */ public function hasCountry(IdentifierInterface $identifier); /** * @return \Heystack\Ecommerce\Currency\Interfaces\CurrencyInterface */ public function getCurrency(); }
true
c37eb4a31e08b1a176c3babb68b14bf615b5bdbc
PHP
spiritabsolute/database-synchronization-system
/src/App/Command/SyncProduce.php
UTF-8
1,110
2.53125
3
[]
no_license
<?php namespace App\Command; use App\SyncQueueManager; use App\SyncManager; use Psr\Container\ContainerInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class SyncProduce extends Command { private $container; public function __construct(ContainerInterface $container, string $name = null) { parent::__construct($name); $this->container = $container; } protected function configure() { parent::configure(); $this->setName('app:sync-produce'); $this->setDescription('Starts synchronization between databases'); } public function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<comment>Start database synchronization</comment>'); $pdo = $this->container->get(\PDO::class); $config = $this->container->get('config')['rabbit']; $syncDataManager = new SyncQueueManager($pdo); $syncSourceManager = new SyncManager($config, $syncDataManager); $syncSourceManager->produce(); $output->writeln('<info>Done!</info>'); return 0; } }
true
dbad5f9c175607075c9c3685517b103e52e00615
PHP
scybwdf/oop
/this.php
UTF-8
264
2.859375
3
[]
no_license
<?php class Ren{ public $name='wf'; public $zuopin='video'; public function pai(){ echo $this->name.'拍php'; } } //$this谁实列化就是谁 $ren=new Ren(); $ren->pai(); $n=new Ren(); $n->name='qq'; $n->pai();
true
6288b06a5ecf790d9ea1c1c36a45b5561ad9187e
PHP
matt61-samples/Calculator
/classes/Calculator.php
UTF-8
2,149
3.5625
4
[]
no_license
<?php /** * Calculator object * * Does the calculations */ class Calculator { /** * Operators available in calculator * @var array */ public $operators = Array(); /** * Stored equation for processing * @var array */ private $equation = Array(); /** * Constructor */ public function __construct() { //Set up default operators, order of operation is preserved. $this->operators = Array( new Operator('*', '*'), new Operator('/', '/'), new Operator('+', '+'), new Operator('-', '-') ); } /** * Check if a passed operator exists in operators array * @param type $passedOperator * @return boolean */ private function hasOperator($passedOperator){ foreach($this->operators as $operator){ if ($operator->customIdentifier == $passedOperator){ return true; } } return false; } /** * Parse and validate equation * @param type $equationString * @throws Exception */ public function loadEquation($equationString){ $equationItems = explode(" ", $equationString); if (count($equationItems) % 2 == 0){ throw new Exception ("Equation has invalid number of items."); } for($i=0;$i<count($equationItems);$i++){ if ($i % 2 == 0 && !is_numeric($equationItems[$i])){ throw new Exception("Invalid operator: ".$equationItems[$i]); } if ($i % 2 == 1 && !$this->hasOperator($equationItems[$i])){ throw new Exception("Invalid number: ".$equationItems[$i]); } $this->equation[] = $equationItems[$i]; } } /** * Calculate answer * @return numeric */ public function calculate(){ $currentEquation = $this->equation; foreach($this->operators as $operator){ while (in_array($operator->customIdentifier, $currentEquation)){ for($i=0;$i<count($currentEquation);$i++){ if ($currentEquation[$i] == $operator->customIdentifier){ $calculated = $operator->calculate($currentEquation[$i-1], $currentEquation[$i+1]); $currentEquation = array_merge(array_slice($currentEquation, 0, $i-1), Array($calculated), array_slice($currentEquation, $i+2)); break; } } } } return $currentEquation[0]; } }
true