Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bf5b346

Browse files
committed
Initial commit for V8JS stubs @ 0.2.1
0 parents commit bf5b346

File tree

10 files changed

+272
-0
lines changed

10 files changed

+272
-0
lines changed

‎.buildpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<buildpath>
3+
<buildpathentry kind="src" path=""/>
4+
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
5+
</buildpath>

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
/.project

‎CREDITS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
v8js
2+
Jani Taskinen
3+
Patrick Reilly
4+
Simon Best
5+
C. Scott Ananian
6+
Stefan Siegl
7+
Mark Johnson

‎LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 The PHP Group
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

‎README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[![Latest Version](https://img.shields.io/packagist/v/phpv8/v8js-stubs.svg?style=flat-square)](https://packagist.org/packages/phpv8/v8js-stubs)
2+
[![Total Downloads](https://img.shields.io/packagist/dt/phpv8/v8js-stubs.svg?style=flat-square)](https://packagist.org/packages/phpv8/v8js-stubs)
3+
[![Software License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/phpv8/v8js-stubs/master/LICENSE)
4+
5+
6+
V8Js Stubs
7+
==========
8+
9+
V8Js PHP stubs for the [V8Js](https://github.com/phpv8/v8js) extension. Versions, tags, and branches
10+
maintain parity with the [phpv8/v8js library](https://github.com/phpv8/v8js).
11+
12+
13+
### Installation
14+
1. Include the `phpv8/v8js-stubs` repository into the **require-dev** section of your `composer.json` as follows:
15+
16+
```json
17+
"require-dev": {
18+
"phpv8/v8js-stubs": "~0.4"
19+
}
20+
```

‎composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "phpv8/v8js-stubs",
3+
"description": "IDE stubs vor V8Js PHP extension",
4+
"require": {
5+
"php": ">=5.3.3"
6+
}
7+
}

‎src/V8Js.php

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<?php
2+
3+
class V8Js
4+
{
5+
/* Constants */
6+
const V8_VERSION = '';
7+
8+
const FLAG_NONE = 1;
9+
10+
const FLAG_FORCE_ARRAY = 2;
11+
12+
const DEBUG_AUTO_BREAK_NEVER = 1;
13+
14+
const DEBUG_AUTO_BREAK_ONCE = 2;
15+
16+
const DEBUG_AUTO_BREAK_ALWAYS = 3;
17+
18+
/* Methods */
19+
20+
/**
21+
* Initializes and starts V8 engine and Returns new V8Js object with it's own V8 context.
22+
*
23+
* @param string $object_name
24+
* @param array $variables
25+
* @param array $extensions
26+
* @param bool $report_uncaught_exceptions
27+
*/
28+
public function __construct($object_name = 'PHP', array $variables = null, array $extensions = null, $report_uncaught_exceptions = true)
29+
{}
30+
31+
/**
32+
* Provide a function or method to be used to load required modules.
33+
* This can be any valid PHP callable.
34+
* The loader function will receive the normalised module path and should return Javascript code to be executed.
35+
*
36+
* @param callable $loader
37+
*/
38+
public function setModuleLoader(callable $loader)
39+
{}
40+
41+
/**
42+
* Compiles and executes script in object's context with optional identifier string.
43+
* A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.
44+
*
45+
* @param string $script
46+
* @param string $identifier
47+
* @param int $flags
48+
* @param int $time_limit in milliseconds
49+
* @param int $memory_limit in bytes
50+
*
51+
* @return mixed
52+
*/
53+
public function executeString($script, $identifier = '', $flags = self::FLAG_NONE, $time_limit = 0, $memory_limit = 0)
54+
{}
55+
56+
/**
57+
* Compiles a script in object's context with optional identifier string.
58+
*
59+
* @param
60+
* $script
61+
* @param string $identifier
62+
* @return resource
63+
*/
64+
public function compileString($script, $identifier = '')
65+
{}
66+
67+
/**
68+
* Executes a precompiled script in object's context.
69+
* A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.
70+
*
71+
* @param resource $script
72+
* @param int $flags
73+
* @param int $time_limit
74+
* @param int $memory_limit
75+
*/
76+
public function executeScript($script, $flags = self::FLAG_NONE, $time_limit = 0, $memory_limit = 0)
77+
{}
78+
79+
/**
80+
* Set the time limit (in milliseconds) for this V8Js object
81+
* works similar to the set_time_limit php
82+
*
83+
* @param int $limit
84+
*/
85+
public function setTimeLimit($limit)
86+
{}
87+
88+
/**
89+
* Set the memory limit (in bytes) for this V8Js object
90+
*
91+
* @param int $limit
92+
*/
93+
public function setMemoryLimit($limit)
94+
{}
95+
96+
/**
97+
* Returns uncaught pending exception or null if there is no pending exception.
98+
*
99+
* @return V8JsScriptException|null
100+
*/
101+
public function getPendingException()
102+
{}
103+
104+
/**
105+
* Clears the uncaught pending exception
106+
*/
107+
public function clearPendingException()
108+
{}
109+
110+
/**
111+
* Starts V8 debug agent for use with Google Chrome Developer Tools (Eclipse Plugin)
112+
*
113+
* @param string $agent_name
114+
* @param int $port
115+
* @param int $auto_break
116+
*
117+
* @return bool
118+
*/
119+
public function startDebugAgent($agent_name = 'V8Js', $port = 9222, $auto_break = self::DEBUG_AUTO_BREAK_NEVER)
120+
{}
121+
122+
/**
123+
* Static methods *
124+
*/
125+
126+
/**
127+
* Registers persistent context independent global Javascript extension.
128+
* NOTE! These extensions exist until PHP is shutdown and they need to be registered before V8 is initialized.
129+
* For best performance V8 is initialized only once per process thus this call has to be done before any V8Js objects are created!
130+
*
131+
* @param string $extension_name
132+
* @param string $code
133+
* @param array $dependencies
134+
* @param bool $auto_enable
135+
*
136+
* @return bool
137+
*/
138+
public static function registerExtension($extension_name, $code, array $dependencies, $auto_enable = false)
139+
{}
140+
141+
/**
142+
* Returns extensions successfully registered with V8Js::registerExtension().
143+
*
144+
* @return array|string[]
145+
*/
146+
public static function getExtensions()
147+
{}
148+
}

‎src/V8JsMemoryLimitException.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
use Exception;
4+
5+
final class V8JsMemoryLimitException extends Exception
6+
{
7+
}

‎src/V8JsScriptException.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
use Exception;
4+
5+
final class V8JsScriptException extends Exception
6+
{
7+
/**
8+
*
9+
* @return string
10+
*/
11+
final public function getJsFileName()
12+
{}
13+
14+
/**
15+
*
16+
* @return int
17+
*/
18+
final public function getJsLineNumber()
19+
{}
20+
21+
/**
22+
*
23+
* @return int
24+
*/
25+
final public function getJsStartColumn()
26+
{}
27+
28+
/**
29+
*
30+
* @return int
31+
*/
32+
final public function getJsEndColumn()
33+
{}
34+
35+
/**
36+
*
37+
* @return string
38+
*/
39+
final public function getJsSourceLine()
40+
{}
41+
42+
/**
43+
*
44+
* @return string
45+
*/
46+
final public function getJsTrace()
47+
{}
48+
}

‎src/V8JsTimeLimitException.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
use Exception;
4+
5+
final class V8JsTimeLimitException extends Exception
6+
{
7+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /