text:
package com.facebook.widget;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.widget.LinearLayout;
import com.facebook.FacebookActivityTestCase;

public class FragmentTestCase<T extends FragmentTestCase.TestFragmentActivity<?>> extends FacebookActivityTestCase<T> {
    public FragmentTestCase(Class<T> activityClass) {
        super(activityClass);
    }

    protected T getTestActivity() {
        return (T) getActivity();
    }

    public static class TestFragmentActivity<T extends Fragment> extends FragmentActivity {
        public static final int FRAGMENT_ID = 0xFACE;

        private Class<T> fragmentClass;
        private int fragmentId;

        protected TestFragmentActivity(Class<T> fragmentClass) {
            this.fragmentClass = fragmentClass;
        }

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            if (getAutoCreateUI()) {
                setContentToFragment(null);
            }
        }

        protected boolean getAutoCreateUI() {
            return true;
        }

        void setContentToFragment(T fragment) {
            if (fragment == null) {
                fragment = createFragment();
            }

            LinearLayout layout = new LinearLayout(this);
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                    LinearLayout.LayoutParams.FILL_PARENT));
            layout.setId(FRAGMENT_ID);

            getSupportFragmentManager().beginTransaction()
                    .add(FRAGMENT_ID, fragment)
                    .commit();

            fragmentId = FRAGMENT_ID;

            setContentView(layout);
        }

        void setContentToLayout(int i, int fragmentId) {
            this.fragmentId = fragmentId;
            setContentView(i);
        }

        T createFragment() {
            try {
                return fragmentClass.newInstance();
            } catch (IllegalAccessException e) {
                fail("could not create fragment");
            } catch (InstantiationException e) {
                fail("could not create fragment");
            }
            return null;
        }

        T getFragment() {
            @SuppressWarnings("unchecked")
            T fragment = (T) getSupportFragmentManager().findFragmentById(fragmentId);
            return fragment;
        }
    }
}


text:
package ch.javasoft.jbase;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.EOFException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

import ch.javasoft.jbase.util.AbstractDataInput;
import ch.javasoft.jbase.util.AbstractDataOutput;
import ch.javasoft.jbase.util.UnsupportedOperationException;

/*
 * TIME values
 * 	col 1: insert
 *  col 2: update or ordered read
 *  col 3: read or unordered read
 *
========

without buffering

testInt (ms) = 718, 2218, 3979
testBigInteger (ms) = 1263, 911, 1050
testBigIntegerCache (ms) = 2332, 2514, 1086, 162
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 872, 3020, 377
testRemoveDeleteFileBigInteger (ms) = 4, 29
testRemoveAllBigInteger (ms) = 98, 2
testSetBigInteger (ms) = 907, 2420, 776
testSetBigInteger (ms) = 860, 1555, 798

testInt (ms) = 587, 615, 607
testBigInteger (ms) = 1059, 959, 945
testBigIntegerCache (ms) = 905, 1468, 2620, 158
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 954, 2974, 362
testRemoveDeleteFileBigInteger (ms) = 4, 1
testRemoveAllBigInteger (ms) = 95, 3
testSetBigInteger (ms) = 853, 2390, 753
testSetBigInteger (ms) = 901, 1609, 770

========
4K

16x256
testInt (ms) = 463, 549, 773
testBigInteger (ms) = 751, 446, 1185
testBigIntegerCache (ms) = 460, 483, 339, 150
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 433, 1843, 154
testRemoveDeleteFileBigInteger (ms) = 4, 1
testRemoveAllBigInteger (ms) = 48, 2
testSetBigInteger (ms) = 392, 6096, 311
testSetBigInteger (ms) = 384, 1955, 365

64x64
testInt (ms) = 504, 591, 742
testBigInteger (ms) = 1321, 616, 1241
testBigIntegerCache (ms) = 1204, 579, 501, 150
testRemoveInt (ms) = 0, 0, 1
testRemoveBigInteger (ms) = 1115, 2340, 237
testRemoveDeleteFileBigInteger (ms) = 4, 1
testRemoveAllBigInteger (ms) = 120, 3
testSetBigInteger (ms) = 1132, 2168, 529
testSetBigInteger (ms) = 1056, 2109, 477

128x32
testInt (ms) = 655, 609, 724
testBigInteger (ms) = 2120, 751, 1227
testBigIntegerCache (ms) = 1857, 811, 674, 237
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 1810, 2882, 336
testRemoveDeleteFileBigInteger (ms) = 3, 1
testRemoveAllBigInteger (ms) = 205, 3
testSetBigInteger (ms) = 1845, 2333, 656
testSetBigInteger (ms) = 1817, 2351, 742

32x128
testInt (ms) = 411, 569, 754
testBigInteger (ms) = 1427, 509, 1173
testBigIntegerCache (ms) = 665, 537, 406, 150
testRemoveInt (ms) = 0, 0, 1
testRemoveBigInteger (ms) = 665, 1963, 180
testRemoveDeleteFileBigInteger (ms) = 3, 1
testRemoveAllBigInteger (ms) = 72, 3
testSetBigInteger (ms) = 601, 2384, 360
testSetBigInteger (ms) = 682, 1955, 425

========

========
16K

256x64
testInt (ms) = 502, 579, 716
testBigInteger (ms) = 1318, 601, 1188
testBigIntegerCache (ms) = 1203, 578, 491, 155
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 1124, 2125, 229
testRemoveDeleteFileBigInteger (ms) = 3, 1
testRemoveAllBigInteger (ms) = 112, 3
testSetBigInteger (ms) = 1085, 1844, 510
testSetBigInteger (ms) = 1023, 2080, 459

64x256
testInt (ms) = 455, 547, 759
testBigInteger (ms) = 734, 455, 1151
testBigIntegerCache (ms) = 424, 432, 344, 157
testRemoveInt (ms) = 0, 0, 1
testRemoveBigInteger (ms) = 432, 1662, 143
testRemoveDeleteFileBigInteger (ms) = 3, 1
testRemoveAllBigInteger (ms) = 48, 2
testSetBigInteger (ms) = 406, 2834, 277
testSetBigInteger (ms) = 387, 1905, 360

========
64K

256x256
testInt (ms) = 439, 561, 702
testBigInteger (ms) = 714, 434, 1127
testBigIntegerCache (ms) = 472, 518, 348, 154
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 434, 1529, 124
testRemoveDeleteFileBigInteger (ms) = 4, 1
testRemoveAllBigInteger (ms) = 46, 3
testSetBigInteger (ms) = 372, 1985, 254
testSetBigInteger (ms) = 376, 1768, 333

64x1024
testInt (ms) = 428, 475, 990
testBigInteger (ms) = 460, 410, 1297
testBigIntegerCache (ms) = 198, 391, 306, 155
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 201, 1538, 95
testRemoveDeleteFileBigInteger (ms) = 5, 1
testRemoveAllBigInteger (ms) = 27, 3
testSetBigInteger (ms) = 244, 2665, 249
testSetBigInteger (ms) = 233, 1998, 272

1024x256
testInt (ms) = 584, 593, 633
testBigInteger (ms) = 1288, 608, 1149
testBigIntegerCache (ms) = 1127, 636, 519, 157
testRemoveInt (ms) = 0, 0, 0
testRemoveBigInteger (ms) = 1105, 1983, 210
testRemoveDeleteFileBigInteger (ms) = 4, 1
testRemoveAllBigInteger (ms) = 112, 2
testSetBigInteger (ms) = 1098, 1699, 470
testSetBigInteger (ms) = 1047, 1946, 421

128x512
testInt (ms) = 353, 565, 725
testBigInteger (ms) = 726, 421, 1098
testBigIntegerCache (ms) = 333, 328, 288, 156
testRemoveInt (ms) = 0, 1, 0
testRemoveBigInteger (ms) = 251, 1429, 105
testRemoveDeleteFileBigInteger (ms) = 4, 1
testRemoveAllBigInteger (ms) = 34, 4
testSetBigInteger (ms) = 304, 2096, 249
testSetBigInteger (ms) = 289, 1809, 250
 */
/**
 * The <tt>BufferedRandomAccessPersister</tt> caches data in a hash table, and
 * delegates the real i/o operations to an underlying delegate
 * {@link RandomAccessPersister}.
 *

 * Note that all cache-access is thread safe. If the caller guarantees that
 * atomic read and write operations do not overlap, the class is thread-safe,
 * even if concurrent read operations are overlapping.
 */
public class BufferedRandomAccessPersister implements RandomAccessPersister {

	private final RandomAccessPersister	delegate;
	private final int 					tableSize;
	private final int 					entrySize;
	private final DataInput				dataInput;
	private final DataOutput			dataOutput;//null for read-copy
	private final ReadWriteLock			lock;

	//hash table entry
	private final static class TableEntry {
		public TableEntry(long start, int size) {
			this.start	= start;
			this.buffer	= new byte[size];
			this.length = size;
		}
		public final long 	start;	//start byte position
		public final byte[]	buffer;
		public volatile int length;
		public volatile boolean dirty;

		@Override
		public String toString() {
			return getClass().getSimpleName() + "[" + start + ".." + (start + length - 1) + "={" +
				(length == 0 ? "" : (buffer[0] + ".." + buffer[length - 1]) + "}]");
		}
	}
	private final AtomicReferenceArray<TableEntry> cache;

	private final ThreadLocal<long[]> pos = new ThreadLocal<long[]>() {
		@Override
		protected long[] initialValue() {return new long[]{0};}
	};

	/**
	 * Constructor using a {@link RandomAccessFilePersistor} as delegate, and
	 * a cache acording to the specified specifications.
	 *

	 * Notes:
	 *

	 *
the maximum cache size is <tt>tableSize * entrySize</tt>

	 *
larger <tt>tableSize</tt> has positive influence on all functions,
	 * 		but especially random read access can profit

	 *
larger <tt>entrySize</tt> has positive influence for sequential write
	 * 		operations, but might have negative affect in combination with
	 * 		small <tt>tableSize</tt> and random modifying operations

	 *

	 *

	 * Recommended values:
	 *

	 *
<tt>tableSize = 64, entrySize = 256</tt>: good setting for general
	 * 		purpose use, maximum cache size is 16K

	 *
<tt>tableSize = 256, entrySize = 64</tt>: faster read operations, on
	 * 		the price of slower writing, maximum cache size is 16K

	 *

	 *
	 * @param file			file to create a {@link RandomAccessFilePersistor}
	 * @param tableSize		number of entries in the hash table
	 * @param entrySize		buffer byte length of a single hash table entry
	 * @throws FileNotFoundException if the specified file is not found
	 */
	public BufferedRandomAccessPersister(File file, int tableSize, int entrySize) throws FileNotFoundException {
		this(new RandomAccessFilePersistor(file), tableSize, entrySize);
	}
	/**
	 * Constructor with delegate persistor and cache specifications.
	 *

	 * Notes:
	 *

	 *
the maximum cache size is <tt>tableSize * entrySize</tt>

	 *
larger <tt>tableSize</tt> has positive influence on all functions,
	 * 		but especially random read access can profit

	 *
larger <tt>entrySize</tt> has positive influence for sequential write
	 * 		operations, but might have negative affect in combination with
	 * 		small <tt>tableSize</tt> and random modifying operations

	 *

	 *

	 * Recommended values:
	 *

	 *
<tt>tableSize = 64, entrySize = 256</tt>: good setting for general
	 * 		purpose use, maximum cache size is 16K

	 *
<tt>tableSize = 256, entrySize = 64</tt>: faster read operations, on
	 * 		the price of slower writing, maximum cache size is 16K

	 *

	 *
	 * @param delegate		delegate persistor, does the real i/o operations
	 * @param tableSize		number of entries in the hash table
	 * @param entrySize		buffer byte length of a single hash table entry
	 */
	public BufferedRandomAccessPersister(RandomAccessPersister delegate, int tableSize, int entrySize) {
		this(delegate, tableSize, entrySize, false, new AtomicReferenceArray<TableEntry>(tableSize), new ReentrantReadWriteLock());
	}
	private BufferedRandomAccessPersister(RandomAccessPersister delegate, int tableSize, int entrySize, boolean readCopy, AtomicReferenceArray<TableEntry> cache, ReadWriteLock lock) {
		if (delegate == null) throw new NullPointerException("delegate cannot be null");
		if (tableSize <= 0) throw new IllegalArgumentException("table size must be positive: " + tableSize);
		if (entrySize <= 0) throw new IllegalArgumentException("entry size must be positive: " + entrySize);
		this.delegate		= delegate;
		this.tableSize		= tableSize;
		this.entrySize		= entrySize;
		this.cache			= cache;
		this.dataInput		= new BufferedDataInput();
		this.dataOutput		= readCopy ? null : new BufferedDataOutput();
		this.lock			= lock;
	}

	public DataInput getInput() throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");
		return dataInput;
	}

	public DataOutput getOutput() throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");
		return dataOutput;
	}

	public long getPosition() throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");
		return pos.get()[0];
	}

	public void setPosition(long bytePos) throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");
		pos.get()[0] = bytePos;
	}

	public void setLength(long byteLength) throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");
		lock.writeLock().lock();
		try {
			for (int i = 0; i < cache.length(); i++) {
				final TableEntry e = cache.get(i);
				if (e != null) {
					if (e.start >= byteLength) {
						//just remove entry
						cache.set(i, null);
					}
					else {
						final long newlen = byteLength - e.start;
						if (newlen < e.length) {
							//resize the entry
							e.length = (int)newlen;
							e.dirty  = true;
						}
					}
				}
			}
		}
		finally {
			lock.writeLock().unlock();
		}
		delegate.setLength(byteLength);
	}

	public void flush() throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");
		lock.readLock().lock();
		try {
			for (int i = 0; i < cache.length(); i++) {
				final TableEntry e = cache.get(i);
				if (e != null && e.dirty) {
					flushDirtyEntry(delegate, e);
				}
			}
		}
		finally {
			lock.readLock().unlock();
		}
		delegate.flush();
	}

	/**
	 * PRECONDITION: read or write lock held
	 */
	protected void flushDirtyEntry(RandomAccessPersister delegate, TableEntry entry) throws IOException {
		synchronized (delegate) {
			if (entry.dirty) {//could already have been saved by someone else
				delegate.setPosition(entry.start);
				delegate.getOutput().write(entry.buffer, 0, entry.length);
				entry.dirty = false;//could be used by someone else
			}
		}
	}

	public void close(boolean erase) throws IOException {
		if (erase && dataOutput == null) {
			throw new UnsupportedOperationException("unmodifyable read copy");
		}
		if (pos.get() != null) {
			pos.set(null);
			lock.readLock().lock();
			try {
				for (int i = 0; i < cache.length(); i++) {
					final TableEntry e;
					if (dataOutput != null) {
						//clear cache if this is not a read copy
						e = cache.getAndSet(i, null);
					}
					else {
						e = cache.get(i);
					}
					if (e != null && e.dirty) {
						flushDirtyEntry(delegate, e);
					}
				}
			}
			finally {
				lock.readLock().unlock();
			}
			delegate.close(erase);
		}
	}

	public RandomAccessPersister createReadCopy(final ReadWriteLock lock) throws IOException {
		flush();
		final RandomAccessPersister copy = new BufferedRandomAccessPersister(
			delegate.createReadCopy(lock), tableSize, entrySize, true,
			cache, BufferedRandomAccessPersister.this.lock) {
			@Override
			public DataOutput getOutput() throws IOException {
				throw new UnsupportedOperationException("read only copy, data output not supported");
			}
			@Override
			public void setLength(long byteLength) throws IOException {
				throw new UnsupportedOperationException("read only copy, setting length not supported");
			}
			@Override
			public void flush() throws IOException {
				throw new UnsupportedOperationException("read only copy, flush not supported");
			}
			@Override
			protected void flushDirtyEntry(RandomAccessPersister copyDelegate, TableEntry entry) throws IOException {
				super.flushDirtyEntry(BufferedRandomAccessPersister.this.delegate, entry);
			}
		};
		copy.setPosition(getPosition());
		return copy;
	}

	/**
	 * PRECONDITION: read or write lock held
	 */
	private TableEntry loadEntry(long start, int tInd, boolean forWrite) throws IOException {
		//read the desired entry
		final TableEntry e = new TableEntry(start, entrySize);
		delegate.setPosition(start);
		try {
			delegate.getInput().readFully(e.buffer);
		}
		catch (EOFException ex) {
			//end of stream, read byte by byte
			delegate.setPosition(start);
			for (int i = 0; i < entrySize; i++) {
				try {
					e.buffer[i] = delegate.getInput().readByte();
				}
				catch (EOFException ex2) {
					e.length = i;
					break;
				}
			}
		}
		if (e.length > 0 || forWrite) {
			//save the old entry, if necessary
			final TableEntry old = cache.getAndSet(tInd, e);
			if (old != null && old.dirty) {
				flushDirtyEntry(delegate, old);
			}
		}
		return e;
	}
	/**
	 * PRECONDITION: read lock held
	 */
	private TableEntry getEntryForRead() throws IOException {
		final long index	= pos.get()[0] / entrySize;
		final long start	= index * entrySize;
		final int tInd		= hash(index) % tableSize;

		final TableEntry e = cache.get(tInd);
		if (e != null && e.start == start) {
			return e;
		}
		return loadEntry(start, tInd, false);
	}
	/**
	 * PRECONDITION: write lock held
	 */
	private TableEntry getEntryForWrite() throws IOException {
		final long index	= pos.get()[0] / entrySize;
		final long start	= index * entrySize;
		final int tInd		= hash(index) % tableSize;

		//try first from cache
		final TableEntry e = cache.get(tInd);
		if (e != null && e.start == start) {
			return e;
		}
		return loadEntry(start, tInd, true);
	}

	private int read(boolean inc) throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");

		final long[] apos = pos.get();
		final int eInd	= (int)(apos[0] % entrySize);

		lock.readLock().lock();
		try {
			final TableEntry e = getEntryForRead();
			if (eInd < e.length) {
				final int v = (0x000000ff & e.buffer[eInd]);
				if (inc) apos[0]++;
				return v;
			}
		}
		finally {
			lock.readLock().unlock();
		}
		//end of stream
		return -1;
	}
	private int read(final byte[] buf, int off, int len) throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");

		final long[] apos = pos.get();
		final int eInd	= (int)(apos[0] % entrySize);

		lock.readLock().lock();
		try {
			final TableEntry e = getEntryForRead();
			final int count = Math.min(e.length - eInd, len);
			if (count > 0) {
				System.arraycopy(e.buffer, eInd, buf, off, count);
				apos[0] += count;
				return count;
			}
		}
		finally {
			lock.readLock().unlock();
		}

		//end of stream
		return -1;
	}

	private void write(int b) throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");

		final long[] apos = pos.get();
		final int eInd	= (int)(apos[0] % entrySize);

		lock.writeLock().lock();
		try {
			final TableEntry e = getEntryForWrite();
			if (eInd < e.buffer.length) {
				e.buffer[eInd] 	= (byte)b;
				e.dirty 		= true;
				e.length		= Math.max(e.length, eInd + 1);
				apos[0]++;
			}
			else {
				//should not happen
				throw new IOException("internal error, write after buffer length: " + eInd + " >= " + e.buffer.length);
			}
		}
		finally {
			lock.writeLock().unlock();
		}
	}

	private int write(byte[] buf, int off, int len) throws IOException {
		if (pos.get() == null) throw new IOException("persister already closed");

		final long[] apos = pos.get();
		final int eInd	= (int)(apos[0] % entrySize);

		lock.writeLock().lock();
		try {
			final TableEntry e = getEntryForWrite();
			final int count = Math.min(e.buffer.length - eInd, len);
			if (count > 0) {
				System.arraycopy(buf, off, e.buffer, eInd, count);
				e.dirty 	= true;
				e.length	= Math.max(e.length, eInd + count);
				apos[0] += count;
				return count;
			}
			//should not happen
			throw new IOException("internal error, write after buffer length: " + eInd + " >= " + e.buffer.length);
		}
		finally {
			lock.writeLock().unlock();
		}
	}

	private class BufferedDataInput extends AbstractDataInput {
		@Override
		protected int peek() throws IOException {
			return BufferedRandomAccessPersister.this.read(false);
		}
		@Override
		protected int read() throws IOException {
			return BufferedRandomAccessPersister.this.read(true);
		}
		@Override
		protected int read(byte[] b, int off, int len) throws IOException {
			return BufferedRandomAccessPersister.this.read(b, off, len);
		}
		@Override
		public int skipBytes(int n) throws IOException {
			//TODO this is very inefficient, but ok for now
			int count = 0;
			while (count < n) {
				final int b = read();
				if (b < 0) return count;
				count++;
			}
			return count;
		}
	}

	private class BufferedDataOutput extends AbstractDataOutput {
		public void write(int b) throws IOException {
			BufferedRandomAccessPersister.this.write(b);
		}
		public void write(byte[] b, int off, int len) throws IOException {
	        int n = 0;
	    	do {
				int count = BufferedRandomAccessPersister.this.write(b, off + n, len - n);
	    	    if (count < 0)
	    		throw new EOFException();
	    	    n += count;
	    	} while (n < len);
		}
	}

    /**
     * Copied from {@link HashMap#hash(int)}
     * (Java 6, or HashMap#newHash(int) in Java 5), merged with
     * {@link Long#hashCode()}.
     *

     * Applies a supplemental hash function to a given hashCode, which
     * defends against poor quality hash functions.  This is critical
     * because HashMap uses power-of-two length hash tables, that
     * otherwise encounter collisions for hashCodes that do not differ
     * in lower bits.
     */
    private static int hash(long value) {
    	int h = (int)(value ^ (value >>> 32));
        // This function ensures that hashCodes that differ only by
        // constant multiples at each bit position have a bounded
        // number of collisions (approximately 8 at default load factor).
        h ^= (h >>> 20) ^ (h >>> 12);
        return h ^ (h >>> 7) ^ (h >>> 4);
    }

}

redpajama_set_name: RedPajamaGithub


text:
* Added chef-client support
* Added warning for cli one-off runs
* Added provider plugins support
* Added provider helper methods
* Updated documentation
* System timeout set to 10 minutes
* Updated handler for node provisioning
* Updated handler for system provisioning
* Node provisioning updates are now evented
* Updated eventmachine to 1.0.0
* Fixed timing issue with mdadm install

### v0.0.3

* Multiple documentation updates
* AWS provider
  * Tags now use `hex(4)` instead of `hex(6)`
  * Deprecated default tag prefix
* Added chef roles support to providers
* Fixed /version url link
* Added `tag`, `domain`, and `fqdn` node helpers
* Bugfix for repo_path
* Hostname is now set at provisioning

### v0.0.2

* AWS provider
  * Added EBS support
  * Added RAID support
  * Added LVM Support
* Added support for chef-solo provisioning
* Switched from `Puma` to `Thin`
* Updated REST API
* Updated command line interface
* Initial Documentation
* Optimized AWS polling mechanism
* Optimized AWS creation ordering

###  v0.0.1

* Application framework laid out
* Initial node state machine
* Initial system state machine
* Added AWS provider
* Initial command line interface
* Added daemonization
* Added singleton configuration
* Initial runlist parser
* Initial dependency traversal
* System rebalancing (pre-provisioning)
* Added REST API


text:
function Scene(game_mc, width, height) {
    this.game_mc = game_mc;
    this.width = width;
    this.height = height;
    this.actors = [];
}

Scene.prototype.register = function(actor) {
    this.actors.push(actor);
    this.game_mc.asCallPublicProperty('addChild', [actor.mc]);
};

Scene.prototype.unregister = function(actor) {
    this.game_mc.asCallPublicProperty('removeChild', [actor.mc]);
    var i = this.actors.indexOf(actor);
    if (i >= 0) {
        this.actors.splice(i, 1);
    }
};

Scene.prototype.toString = function() {
    return "[object Scene]";
};

function Actor(scene, mc, x, y) {
    this.scene = scene;
    this.x = x;
    this.y = y;
    this.mc = mc;
    this.mc.asSetPublicProperty('x', x);
    this.mc.asSetPublicProperty('y', y);
    scene.register(this);
}

Actor.prototype.moveTo = function(x, y) {
    this.x = x;
    this.y = y;
    this.mc.asSetPublicProperty('x', x);
    this.mc.asSetPublicProperty('y', y);
}

Actor.prototype.width = function() {
    return this.mc.asGetPublicProperty('width');
};

Actor.prototype.height = function() {
    return this.mc.asGetPublicProperty('height');
};

Actor.prototype.exit = function() {
    this.scene.unregister(this);
};

Actor.prototype.toString = function() {
    return "[" + this.type + " at " + this.x + ", " + this.y + "]";
};

function Alien(scene, x, y, direction, speed, strength) {
    var avm2 = Shumway.AVM2.Runtime.AVM2.instance;
    var SpaceshipClass = avm2.applicationDomain.getClass('twits.Spaceship');
    Actor.call(this, scene, new SpaceshipClass.instanceConstructor(), x, y);
    this.direction = direction;
    this.speed = speed;
    this.strength = strength;
    this.damage = 0;
}

Alien.prototype = Object.create(Actor.prototype);

Alien.prototype.type = "alien";

Alien.prototype.hit = function() {
    this.damage++;
    this.mc.asSetPublicProperty('alpha', 1 - (this.damage / this.strength));
};

Alien.prototype.dead = function() {
    return this.damage >= this.strength;
};

Alien.prototype.collidesWith = function(x, y, width, height) {
    var left = this.x - this.width() / 2, right = left + this.width(),
        top = this.y, bottom = top + this.height();
    return ((x > left && x < right) ||
            (x + width > left && x + width < right))
        && ((y > top && y < bottom) ||
            (y + height > top && y + height < bottom));
};

Alien.prototype.move = function() {
    var newX = this.x + (this.speed * this.direction);
    if (newX < this.width() / 2 || newX > this.scene.width - this.width() / 2) {
        this.direction *= -1;
        newX = this.x + (this.speed * this.direction);
    }
    this.moveTo(newX, this.y);
};

function SpaceShip(scene, x, y) {
    var avm2 = Shumway.AVM2.Runtime.AVM2.instance;
    var RocketClass = avm2.applicationDomain.getClass('twits.Rocket');
    Actor.call(this, scene, new RocketClass.instanceConstructor(), x, y);
    this.points = 0;
}

SpaceShip.prototype = Object.create(Actor.prototype);

SpaceShip.prototype.score = function() {
    this.points++;
};

SpaceShip.prototype.type = "spaceShip";

SpaceShip.prototype.left = function() {
    var minPosition = this.width() / 2;
    this.moveTo(Math.max(this.x - 10, minPosition), this.y);
};

SpaceShip.prototype.right = function() {
    var maxPosition = this.scene.width - this.width() / 2;
    this.moveTo(Math.min(this.x + 10, maxPosition), this.y);
};

function Shot(scene, x, y) {
    var avm2 = Shumway.AVM2.Runtime.AVM2.instance;
    var ShotClass = avm2.applicationDomain.getClass('twits.Shot');
    Actor.call(this, scene, new ShotClass.instanceConstructor(), x, y);
}

Shot.prototype = Object.create(Actor.prototype);

Shot.prototype.type = "shot";

// Controller
var Shumway;
function playTwits(shumwayObj) {
    Shumway = shumwayObj.Shumway;
    var game_mc = shumwayObj.stage.getChildAt(0);
    var width = shumwayObj.stage.stageWidth;
    var height = shumwayObj.stage.stageHeight;

    var SPACESHIP_HEIGHT = 50;
    var ALIEN_WIDTH = 50;
    var SCORE_HEIGHT = 40;

    var mid = width / 2;

    var scene, spaceShip, alien;

    scene = new Scene(game_mc, width, height);
    spaceShip = new SpaceShip(scene,
                              mid,
                              height - SPACESHIP_HEIGHT - SCORE_HEIGHT);
    alien = newAlien();

    var moving;

    function newAlien() {
        var x = Math.random() * (width - ALIEN_WIDTH) + (ALIEN_WIDTH / 2);
        var strength = Math.floor(Math.random() * 4) + 2;
        var direction = Math.random() < 0.5 ? -1 : 1;
        var speed = (Math.random() * 10) + 5;
        var alien = new Alien(scene, x, 10, direction, speed, strength);
        moving = setInterval(alien.move.bind(alien), 100);
        return alien;
    }

    function fire() {
        var shot = new Shot(scene, 0, 0);
        shot.moveTo(spaceShip.x + (spaceShip.width() / 2) - (shot.width() / 2),
                    spaceShip.y - shot.height());
        var firing = setInterval(function() {
            var newY = shot.y - 15;
            if (newY < 0) {
                shot.exit();
                clearInterval(firing);
            } else if (alien.collidesWith(shot.x, newY, shot.width(), shot.height())) {
                alien.hit();
                if (alien.dead()) {
                    score();
                    alien.exit();
                    clearInterval(moving);
                    alien = newAlien();
                }
                shot.exit();
                clearInterval(firing);
            } else {
                shot.moveTo(shot.x, newY);
            }
        }, 30);
    }

    function score() {
        spaceShip.score();
        game_mc.asCallPublicProperty('getChildByName', ["score"]).
                asSetPublicProperty('text', String(spaceShip.points * 1000));
    }

    var holdingLeft, holdingRight;

    function stopLeft() {
        if (typeof holdingLeft === "undefined") {
            return;
        }
        clearInterval(holdingLeft);
        holdingLeft = void 0;
    }

    function stopRight() {
        if (typeof holdingRight === "undefined") {
            return;
        }
        clearInterval(holdingRight);
        holdingRight = void 0;
    }

    window.onkeydown = function(event) {
        switch (event.keyCode) {
          case 37:
            if (typeof holdingLeft !== "undefined") {
                break;
            }
            stopRight();
            spaceShip.left();
            holdingLeft = setInterval(spaceShip.left.bind(spaceShip), 30);
            break;
          case 39:
            if (typeof holdingRight !== "undefined") {
                break;
            }
            stopLeft();
            spaceShip.right();
            holdingRight = setInterval(spaceShip.right.bind(spaceShip), 30);
            break;
        }
    };

    window.onkeyup = function(event) {
        switch (event.keyCode) {
          case 13:
          case 32:
            fire();
            break;
          case 37:
            stopLeft();
            break;
          case 39:
            stopRight();
            break;
        }
    };
}


text:
package me.ycdev.android.lib.multidexcreator;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Map;
import java.util.TreeMap;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import me.ycdev.android.lib.multidexcreator.util.IoUtils;

public class MutilDexCreator {
    private static final String RULE_JAR_PREFIX = "jar:";
    private static final String RULE_CLASS_PREFIX = "class:";

    private final String mClassesProguardJarFile;
    private final String mProguardMappingFile;
    private final String mSecondaryDexClassesRules;
    private final String mMainDexClassesListFile;
    private final String mSecondaryDexClassesListFile;

    // mapping: originClassFilePath -> proguardClassFilePath
    private TreeMap<String, String> mMainDexClasses = new TreeMap<>();
    private TreeMap<String, String> mSecondaryDexClasses = new TreeMap<>();

    private HashSet<String> mSecondaryDexRuleClasses = new HashSet<>();
    private ArrayList<String> mSecondaryDexRulePatterns = new ArrayList<>();

    public static void main(String args[]) {
        if (args.length != 5) {
            System.out.println("Usage: java -jar MultiDexCreator.jar" +
                    " classesProguardJarFile mappingFile secondaryDexClassesRules" +
                    " mainDexClassesListFile secondaryDexClassesListFile");
            return;
        }

        try {
            MutilDexCreator creator = new MutilDexCreator(args[0], args[1], args[2], args[3], args[4]);
            creator.createMainDexClassesList();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public MutilDexCreator(String classesProguardJarFile, String proguardMappingFile,
            String secondaryDexClassesRules, String mainDexClassesListFile,
            String secondaryDexClassesListFile) {
        mClassesProguardJarFile = classesProguardJarFile;
        mProguardMappingFile = proguardMappingFile;
        mSecondaryDexClassesRules = secondaryDexClassesRules;
        mMainDexClassesListFile = mainDexClassesListFile;
        mSecondaryDexClassesListFile = secondaryDexClassesListFile;
    }

    private void createMainDexClassesList() throws IOException {
        // Step1: Load class rules in secondary dex
        loadSecondaryDexClassesRules();

        // Step 2: Load all classes
        if (new File(mProguardMappingFile).exists()) {
            // proguard enabled and obfuscate enabled
            loadProguardClasses();
        } else {
            // proguard enabled but "dontobfuscate" enabled
            ArrayList<String> allClasses = getZipClasses(mClassesProguardJarFile);
            for (String classFilePath : allClasses) {
                if (!belongsSecondaryDex(classFilePath)) {
                    mMainDexClasses.put(classFilePath, classFilePath);
                } else {
                    mSecondaryDexClasses.put(classFilePath, classFilePath);
                }
            }
        }

        // Step 3: Generate the dex classes list file
        saveDexClassesList(mMainDexClassesListFile, mMainDexClasses);
        saveDexClassesList(mSecondaryDexClassesListFile, mSecondaryDexClasses);
    }

    private void loadSecondaryDexClassesRules() throws IOException {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new FileReader(mSecondaryDexClassesRules));
            String line;
            while ((line = br.readLine()) != null) {
                line = line.trim();
                if (line.isEmpty() || line.startsWith("#")) {
                    // skip blank line and comment line
                    continue;
                }

                if (line.startsWith(RULE_JAR_PREFIX)) {
                    String filePath = line.substring(RULE_JAR_PREFIX.length()).trim();
                    ArrayList<String> jarClasses = getZipClasses(filePath);
                    for (String classFilePath : jarClasses) {
                        mSecondaryDexRuleClasses.add(classFilePath);
                    }
                } else if (line.startsWith(RULE_CLASS_PREFIX)) {
                    String pattern = line.substring(RULE_CLASS_PREFIX.length()).trim();
                    mSecondaryDexRulePatterns.add(pattern);
                }
            }
        } finally {
            IoUtils.close(br);
        }
    }

    private static ArrayList<String> getZipClasses(String zipFilePath) throws IOException{
        ZipFile zf = null;
        ArrayList<String> result = new ArrayList<>();
        try {
            zf = new ZipFile(zipFilePath);
            Enumeration<? extends ZipEntry> it = zf.entries();
            while (it.hasMoreElements()) {
                ZipEntry entry = it.nextElement();
                String filePath = entry.getName();
                if (!entry.isDirectory() && filePath.endsWith(".class")) {
                    result.add(filePath);
                }
            }
        } finally {
            IoUtils.close(zf);
        }
        return result;
    }

    private boolean belongsSecondaryDex(String classFilePath) {
        if (mSecondaryDexRuleClasses.contains(classFilePath)) {
            return true;
        }
        for (String classPattern : mSecondaryDexRulePatterns) {
            if (classFilePath.matches(classPattern)) {
                return true;
            }
        }
        return false;
    }

    private void loadProguardClasses() throws IOException {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new FileReader(mProguardMappingFile));
            String line;
            while ((line = br.readLine()) != null) {
                line = line.trim();
                if (line.endsWith(":")) {
                    int pos = line.indexOf("->");
                    String key = line.substring(0, pos).trim();
                    key = key.replace(".", "/") + ".class";
                    String value = line.substring(pos + 2).trim();
                    value = value.replace(".", "/").replace(":", ".class");
                    if (!belongsSecondaryDex(key)) {
                        mMainDexClasses.put(key, value);
                    } else {
                        mSecondaryDexClasses.put(key, value);
                    }
                }
            }
        } finally {
            IoUtils.close(br);
        }
    }

    private void saveDexClassesList(String filePath, Map<String, String> classes)
            throws IOException {
        BufferedWriter bw = null;
        try {
            bw = new BufferedWriter(new FileWriter(filePath));
            for (String classFilePath : classes.values()) {
                bw.write(classFilePath);
                bw.write('\n');
            }
            bw.flush();
        } finally {
            IoUtils.close(bw);
        }
    }
}


text:
package net.duckling.vmt.domain.email;

import java.util.List;

public class EmailDetail {
	private Email email;
	private List<EmailGetter> getters;
	private List<EmailFile> files;
	public Email getEmail() {
		return email;
	}
	public void setEmail(Email email) {
		this.email = email;
	}
	public List<EmailGetter> getGetters() {
		return getters;
	}
	public void setGetters(List<EmailGetter> getters) {
		this.getters = getters;
	}
	public List<EmailFile> getFiles() {
		return files;
	}
	public void setFiles(List<EmailFile> files) {
		this.files = files;
	}

}


text:
package org.apache.flink.streaming.connectors.elasticsearch6;

import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer;

import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.bulk.BulkProcessor;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.update.UpdateRequest;

import java.util.concurrent.atomic.AtomicLong;

import static org.apache.flink.util.Preconditions.checkNotNull;

/**
 * Implementation of a {@link RequestIndexer}, using a {@link BulkProcessor}. {@link ActionRequest
 * ActionRequests} will be buffered before sending a bulk request to the Elasticsearch cluster.
 *
 * <p>Note: This class is binary compatible to Elasticsearch 6.
 */
@Internal
class Elasticsearch6BulkProcessorIndexer implements RequestIndexer {

    private final BulkProcessor bulkProcessor;
    private final boolean flushOnCheckpoint;
    private final AtomicLong numPendingRequestsRef;

    Elasticsearch6BulkProcessorIndexer(
            BulkProcessor bulkProcessor,
            boolean flushOnCheckpoint,
            AtomicLong numPendingRequestsRef) {
        this.bulkProcessor = checkNotNull(bulkProcessor);
        this.flushOnCheckpoint = flushOnCheckpoint;
        this.numPendingRequestsRef = checkNotNull(numPendingRequestsRef);
    }

    @Override
    public void add(DeleteRequest... deleteRequests) {
        for (DeleteRequest deleteRequest : deleteRequests) {
            if (flushOnCheckpoint) {
                numPendingRequestsRef.getAndIncrement();
            }
            this.bulkProcessor.add(deleteRequest);
        }
    }

    @Override
    public void add(IndexRequest... indexRequests) {
        for (IndexRequest indexRequest : indexRequests) {
            if (flushOnCheckpoint) {
                numPendingRequestsRef.getAndIncrement();
            }
            this.bulkProcessor.add(indexRequest);
        }
    }

    @Override
    public void add(UpdateRequest... updateRequests) {
        for (UpdateRequest updateRequest : updateRequests) {
            if (flushOnCheckpoint) {
                numPendingRequestsRef.getAndIncrement();
            }
            this.bulkProcessor.add(updateRequest);
        }
    }
}


text:
Check all extension entities
--SKIPIF--
<?php if (!extension_loaded("v8")) print "skip"; ?>
--FILE--
<?php

class Dumper
{
    public function dumpExtension()
    {
        $re = new ReflectionExtension('v8');

        // echo 'Name: ', $re->getName(), PHP_EOL;
        // echo 'Version: ', $re->getVersion(), PHP_EOL;

        echo PHP_EOL;
        echo 'Extension-global functions:', PHP_EOL;

        if ($re->getFunctions()) {
            foreach ($re->getFunctions() as $rf) {
                $this->dumpFunction($rf);
            }
        } else {
            echo 'none', PHP_EOL;
        }

        echo PHP_EOL;
        echo 'Extension-global constants:', PHP_EOL;

        if ($re->getConstants()) {
            foreach ($re->getConstants() as $name => $value) {
                echo "$name = ", var_export($value, true), PHP_EOL;
            }
        } else {
            echo 'none', PHP_EOL;
        }

        echo PHP_EOL;
        echo 'Extension-global classes:', PHP_EOL;

        if ($re->getClasses()) {
            foreach ($re->getClasses() as $rc) {
                $this->dumpClass($rc);
                echo PHP_EOL;
            }
        } else {
            echo 'none', PHP_EOL;
        }

    }

    protected function dumpClass(ReflectionClass $rc)
    {
        if ($rc->isTrait()) {
            echo 'trait ';
        } elseif ($rc->isInterface()) {
            echo 'interface ';
        } else {
            if ($rc->isAbstract()) {
                echo 'abstract ';
            }

            if ($rc->isFinal()) {
                echo 'final ';
            }

            echo 'class ';
        }

        echo $rc->getName(), PHP_EOL;

        if ($rc->getParentClass()) {
            echo '    extends ', $rc->getParentClass()->getName(), PHP_EOL;
        }

        foreach ($rc->getInterfaces() as $ri) {
            echo '    implements ', $ri->getName(), PHP_EOL;
        }

        foreach ($rc->getTraits() as $rt) {
            echo '    use ', $rt->getName(), PHP_EOL;
        }

        foreach ($rc->getConstants() as $name => $value) {
            echo "    const {$name} = ", var_export($value, true), PHP_EOL;
        }

        foreach ($rc->getProperties() as $rp) {
            if ($rp->getDeclaringClass() != $rc) {
                continue;
            }

            echo '    ';

            if ($rp->isStatic()) {
                echo 'static ';
            }

            if ($rp->isPublic()) {
                echo 'public ';
            }

            if ($rp->isProtected()) {
                echo 'protected ';
            }

            if ($rp->isPrivate()) {
                echo 'private ';
            }

            echo '$', $rp->getName();
            echo PHP_EOL;
        }

        foreach ($rc->getMethods() as $rm) {
            if ($rm->getDeclaringClass() != $rc) {
                continue;
            }

            echo '    ';

            if ($rm->isAbstract()) {
                echo 'abstract ';
            }

            if ($rm->isFinal()) {
                echo 'final ';
            }

            if ($rm->isPublic()) {
                echo 'public ';
            }

            if ($rm->isProtected()) {
                echo 'protected ';
            }

            if ($rm->isPrivate()) {
                echo 'private ';
            }

            if ($rm->isStatic()) {
                echo 'static ';
            }

            echo 'function ', $rm->getName();
            echo $this->dumpPartialFunction($rm), PHP_EOL;
        }
    }

    protected function dumpFunction(ReflectionFunction $rf)
    {
        if ($rf->inNamespace()) {
            echo $rf->getNamespaceName(), ': ';
        }

        echo 'function ', $rf->getName();

        echo $this->dumpPartialFunction($rf);
        echo PHP_EOL;
    }

    protected function dumpPartialFunction(ReflectionFunctionAbstract $rf)
    {
        $ret = '(';

        $parameters = [];
        foreach ($rf->getParameters() as $parameter) {
            $parameters[] = $this->dumpParameter($parameter);
        }

        $ret .= implode(', ', $parameters);

        $ret .= ')';

        if ($rf->hasReturnType()) {
            $ret .= ': ' . ($rf->getReturnType()->allowsNull() ? '?' : '') . $rf->getReturnType();
        }

        return $ret;
    }

    protected function dumpParameter(ReflectionParameter $rp)
    {
        $ret = [];

        $ret[] = $rp->hasType() ? ($rp->allowsNull() ? '?' : '') . (string)$rp->getType() : null;
        $ret[] = ($rp->isVariadic() ? '...' : '') . "\${$rp->getName()}";

        // $ret[] = $rp->isOptional() ? '= ?' : '';

        return trim(implode(' ', $ret));
    }
}

$d = new Dumper();

$d->dumpExtension();

?>
--EXPECT--
Extension-global functions:
none

Extension-global constants:
none

Extension-global classes:
final class V8\AccessControl
    const DEFAULT_ACCESS = 0
    const ALL_CAN_READ = 1
    const ALL_CAN_WRITE = 2

final class V8\ConstructorBehavior
    const THROW = 0
    const ALLOW = 1

final class V8\IntegrityLevel
    const FROZEN = 0
    const SEALED = 1

final class V8\PropertyAttribute
    const NONE = 0
    const READ_ONLY = 1
    const DONT_ENUM = 2
    const DONT_DELETE = 4

final class V8\PropertyHandlerFlags
    const NONE = 0
    const ALL_CAN_READ = 1
    const NON_MASKING = 2
    const ONLY_INTERCEPT_STRINGS = 4

final class V8\PropertyFilter
    const ALL_PROPERTIES = 0
    const ONLY_WRITABLE = 1
    const ONLY_ENUMERABLE = 2
    const ONLY_CONFIGURABLE = 4
    const SKIP_STRINGS = 8
    const SKIP_SYMBOLS = 16

final class V8\KeyCollectionMode
    const OWN_ONLY = 0
    const INCLUDE_PROTOTYPES = 1

final class V8\IndexFilter
    const INCLUDE_INDICES = 0
    const SKIP_INDICES = 1

final class V8\RAILMode
    const PERFORMANCE_RESPONSE = 0
    const PERFORMANCE_ANIMATION = 1
    const PERFORMANCE_IDLE = 2
    const PERFORMANCE_LOAD = 3

class V8\Exceptions\Exception
    extends Exception
    implements Throwable

class V8\Exceptions\TryCatchException
    extends V8\Exceptions\Exception
    implements Throwable
    private $isolate
    private $context
    private $try_catch
    public function __construct(V8\Isolate $isolate, V8\Context $context, V8\TryCatch $try_catch)
    public function getIsolate(): V8\Isolate
    public function getContext(): V8\Context
    public function getTryCatch(): V8\TryCatch

class V8\Exceptions\TerminationException
    extends V8\Exceptions\TryCatchException
    implements Throwable

class V8\Exceptions\ResourceLimitException
    extends V8\Exceptions\TerminationException
    implements Throwable

class V8\Exceptions\TimeLimitException
    extends V8\Exceptions\ResourceLimitException
    implements Throwable

class V8\Exceptions\MemoryLimitException
    extends V8\Exceptions\ResourceLimitException
    implements Throwable

class V8\Exceptions\ValueException
    extends V8\Exceptions\Exception
    implements Throwable

interface V8\AdjustableExternalMemoryInterface
    abstract public function adjustExternalAllocatedMemory(int $change_in_bytes): int
    abstract public function getExternalAllocatedMemory(): int

class V8\HeapStatistics
    private $total_heap_size
    private $total_heap_size_executable
    private $total_physical_size
    private $total_available_size
    private $used_heap_size
    private $heap_size_limit
    private $malloced_memory
    private $peak_malloced_memory
    private $does_zap_garbage
    private $number_of_native_contexts
    private $number_of_detached_contexts
    public function __construct(float $total_heap_size, float $total_heap_size_executable, float $total_physical_size, float $total_available_size, float $used_heap_size, float $heap_size_limit, float $malloced_memory, float $peak_malloced_memory, bool $does_zap_garbage)
    public function getTotalHeapSize(): float
    public function getTotalHeapSizeExecutable(): float
    public function getTotalPhysicalSize(): float
    public function getTotalAvailableSize(): float
    public function getUsedHeapSize(): float
    public function getHeapSizeLimit(): float
    public function getMallocedMemory(): float
    public function getPeakMallocedMemory(): float
    public function doesZapGarbage(): bool
    public function getNumberOfNativeContexts(): float
    public function getNumberOfDetachedContexts(): float

class V8\StartupData
    public function __construct(string $blob)
    public function getData(): string
    public function isRejected(): bool
    public static function createFromSource(string $source): V8\StartupData
    public static function warmUpSnapshotDataBlob(V8\StartupData $cold_startup_data, string $warmup_source): V8\StartupData

class V8\Isolate
    const MEMORY_PRESSURE_LEVEL_NONE = 0
    const MEMORY_PRESSURE_LEVEL_MODERATE = 1
    const MEMORY_PRESSURE_LEVEL_CRITICAL = 2
    public function __construct(?V8\StartupData $snapshot)
    public function within(callable $callback)
    public function setTimeLimit(float $time_limit_in_seconds)
    public function getTimeLimit(): float
    public function isTimeLimitHit(): bool
    public function setMemoryLimit(int $memory_limit_in_bytes)
    public function getMemoryLimit(): int
    public function isMemoryLimitHit(): bool
    public function memoryPressureNotification(int $level)
    public function getHeapStatistics(): V8\HeapStatistics
    public function inContext(): bool
    public function getEnteredContext(): V8\Context
    public function throwException(V8\Context $context, V8\Value $value, Throwable $e)
    public function idleNotificationDeadline($deadline_in_seconds): bool
    public function lowMemoryNotification()
    public function setRAILMode(int $rail_mode)
    public function terminateExecution()
    public function isExecutionTerminating(): bool
    public function cancelTerminateExecution()
    public function isDead(): bool
    public function isInUse(): bool
    public function setCaptureStackTraceForUncaughtExceptions(bool $capture, int $frame_limit)

class V8\Context
    private $isolate
    public function __construct(V8\Isolate $isolate, ?V8\ObjectTemplate $global_template, ?V8\ObjectValue $global_object)
    public function within(callable $callback)
    public function getIsolate(): V8\Isolate
    public function globalObject(): V8\ObjectValue
    public function detachGlobal()
    public function setSecurityToken(V8\Value $token)
    public function useDefaultSecurityToken()
    public function getSecurityToken(): V8\Value
    public function allowCodeGenerationFromStrings(bool $allow)
    public function isCodeGenerationFromStringsAllowed(): bool
    public function setErrorMessageForCodeGenerationFromStrings(V8\StringValue $message)

class V8\Script
    private $isolate
    private $context
    public function __construct(V8\Context $context, V8\StringValue $source, V8\ScriptOrigin $origin)
    public function getIsolate(): V8\Isolate
    public function getContext(): V8\Context
    public function run(V8\Context $context): V8\Value
    public function getUnboundScript(): V8\UnboundScript

class V8\UnboundScript
    private $isolate
    private function __construct()
    public function getIsolate(): V8\Isolate
    public function bindToContext(V8\Context $context): V8\Script
    public function getId(): ?int
    public function getScriptName(): V8\Value
    public function getSourceURL(): V8\Value
    public function getSourceMappingURL(): V8\Value
    public function getLineNumber(int $code_pos): int

class V8\ScriptCompiler\CachedData
    public function __construct(string $data)
    public function getData(): string
    public function isRejected(): bool

class V8\ScriptCompiler\Source
    private $source_string
    private $origin
    private $cached_data
    public function __construct(V8\StringValue $source_string, ?V8\ScriptOrigin $origin, ?V8\ScriptCompiler\CachedData $cached_data)
    public function getSourceString(): V8\StringValue
    public function getScriptOrigin(): ?V8\ScriptOrigin
    public function getCachedData(): ?V8\ScriptCompiler\CachedData

class V8\ScriptCompiler
    const OPTION_NO_COMPILE_OPTIONS = 0
    const OPTION_CONSUME_CODE_CACHE = 5
    const OPTION_EAGER_COMPILE = 6
    public static function getCachedDataVersionTag(): float
    public static function compileUnboundScript(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\UnboundScript
    public static function compile(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\Script
    public static function compileFunctionInContext(V8\Context $context, V8\ScriptCompiler\Source $source, array $arguments, array $context_extensions): V8\FunctionObject
    public static function createCodeCache(V8\UnboundScript $unbound_script, V8\StringValue $source_string): V8\ScriptCompiler\CachedData

class V8\ExceptionManager
    public static function createRangeError(V8\Context $context, V8\StringValue $message): V8\ObjectValue
    public static function createReferenceError(V8\Context $context, V8\StringValue $message): V8\ObjectValue
    public static function createSyntaxError(V8\Context $context, V8\StringValue $message): V8\ObjectValue
    public static function createTypeError(V8\Context $context, V8\StringValue $message): V8\ObjectValue
    public static function createError(V8\Context $context, V8\StringValue $message): V8\ObjectValue
    public static function createMessage(V8\Context $context, V8\Value $exception): V8\Message
    public static function getStackTrace(V8\Context $context, V8\Value $exception): ?V8\StackTrace

class V8\TryCatch
    private $isolate
    private $context
    private $exception
    private $stack_trace
    private $message
    private $can_continue
    private $has_terminated
    private $external_exception
    public function __construct(V8\Isolate $isolate, V8\Context $context, ?V8\Value $exception, ?V8\Value $stack_trace, ?V8\Message $message, bool $can_continue, bool $has_terminated, ?Throwable $external_exception)
    public function getIsolate(): V8\Isolate
    public function getContext(): V8\Context
    public function getException(): ?V8\Value
    public function getStackTrace(): ?V8\Value
    public function getMessage(): ?V8\Message
    public function canContinue(): bool
    public function hasTerminated(): bool
    public function getExternalException(): ?Throwable

class V8\Message
    const ERROR_LEVEL_LOG = 1
    const ERROR_LEVEL_DEBUG = 2
    const ERROR_LEVEL_INFO = 4
    const ERROR_LEVEL_ERROR = 8
    const ERROR_LEVEL_WARNING = 16
    const ERROR_LEVEL_ALL = 31
    private $message
    private $script_origin
    private $source_line
    private $resource_name
    private $stack_trace
    private $line_number
    private $start_position
    private $end_position
    private $start_column
    private $end_column
    private $error_level
    public function __construct(string $message, string $source_line, V8\ScriptOrigin $script_origin, string $resource_name, V8\StackTrace $stack_trace, ?int $line_number, ?int $start_position, ?int $end_position, ?int $start_column, ?int $end_column, ?int $error_level)
    public function get(): string
    public function getSourceLine(): string
    public function getScriptOrigin(): V8\ScriptOrigin
    public function getScriptResourceName(): string
    public function getStackTrace(): ?V8\StackTrace
    public function getLineNumber(): ?int
    public function getStartPosition(): ?int
    public function getEndPosition(): ?int
    public function getStartColumn(): ?int
    public function getEndColumn(): ?int
    public function getErrorLevel(): ?int

class V8\StackFrame
    private $line_number
    private $column
    private $script_id
    private $script_name
    private $script_name_or_source_url
    private $function_name
    private $is_eval
    private $is_constructor
    private $is_wasm
    public function __construct(?int $line_number, ?int $column, ?int $script_id, string $script_name, string $script_name_or_source_url, string $function_name, bool $is_eval, bool $is_constructor, bool $is_wasm)
    public function getLineNumber(): ?int
    public function getColumn(): ?int
    public function getScriptId(): ?int
    public function getScriptName(): string
    public function getScriptNameOrSourceURL(): string
    public function getFunctionName(): string
    public function isEval(): bool
    public function isConstructor(): bool
    public function isWasm(): bool

class V8\StackTrace
    const MIN_FRAME_LIMIT = 0
    const MAX_FRAME_LIMIT = 1000
    private $frames
    public function __construct(array $frames)
    public function getFrames(): array
    public function getFrame(int $index): V8\StackFrame
    public function getFrameCount(): int
    public static function currentStackTrace(V8\Isolate $isolate, int $frame_limit): V8\StackTrace

class V8\ScriptOriginOptions
    const IS_SHARED_CROSS_ORIGIN = 1
    const IS_OPAQUE = 2
    const IS_WASM = 4
    const IS_MODULE = 8
    private $flags
    public function __construct(int $options)
    public function getFlags(): int
    public function isSharedCrossOrigin(): bool
    public function isOpaque(): bool
    public function isWasm(): bool
    public function isModule(): bool

class V8\ScriptOrigin
    private $resource_name
    private $resource_line_offset
    private $resource_column_offset
    private $script_id
    private $source_map_url
    private $options
    public function __construct(string $resource_name, ?int $resource_line_offset, ?int $resource_column_offset, ?int $script_id, string $source_map_url, ?V8\ScriptOriginOptions $options)
    public function resourceName(): string
    public function resourceLineOffset(): ?int
    public function resourceColumnOffset(): ?int
    public function scriptId(): ?int
    public function sourceMapUrl(): string
    public function options(): V8\ScriptOriginOptions

class V8\Data

abstract class V8\Value
    extends V8\Data
    private $isolate
    public function getIsolate(): V8\Isolate
    public function isUndefined(): bool
    public function isNull(): bool
    public function isNullOrUndefined(): bool
    public function isTrue(): bool
    public function isFalse(): bool
    public function isName(): bool
    public function isString(): bool
    public function isSymbol(): bool
    public function isFunction(): bool
    public function isArray(): bool
    public function isObject(): bool
    public function isBoolean(): bool
    public function isNumber(): bool
    public function isInt32(): bool
    public function isUint32(): bool
    public function isDate(): bool
    public function isArgumentsObject(): bool
    public function isBooleanObject(): bool
    public function isNumberObject(): bool
    public function isStringObject(): bool
    public function isSymbolObject(): bool
    public function isNativeError(): bool
    public function isRegExp(): bool
    public function isAsyncFunction(): bool
    public function isGeneratorFunction(): bool
    public function isGeneratorObject(): bool
    public function isPromise(): bool
    public function isMap(): bool
    public function isSet(): bool
    public function isMapIterator(): bool
    public function isSetIterator(): bool
    public function isWeakMap(): bool
    public function isWeakSet(): bool
    public function isArrayBuffer(): bool
    public function isArrayBufferView(): bool
    public function isTypedArray(): bool
    public function isUint8Array(): bool
    public function isUint8ClampedArray(): bool
    public function isInt8Array(): bool
    public function isUint16Array(): bool
    public function isInt16Array(): bool
    public function isUint32Array(): bool
    public function isInt32Array(): bool
    public function isFloat32Array(): bool
    public function isFloat64Array(): bool
    public function isBigInt64Array(): bool
    public function isBigUint64Array(): bool
    public function isDataView(): bool
    public function isSharedArrayBuffer(): bool
    public function isProxy(): bool
    public function toBoolean(V8\Context $context): V8\BooleanValue
    public function toNumber(V8\Context $context): V8\NumberValue
    public function toString(V8\Context $context): V8\StringValue
    public function toDetailString(V8\Context $context): V8\StringValue
    public function toObject(V8\Context $context): V8\ObjectValue
    public function toInteger(V8\Context $context): V8\IntegerValue
    public function toUint32(V8\Context $context): V8\Uint32Value
    public function toInt32(V8\Context $context): V8\Int32Value
    public function toArrayIndex(V8\Context $context): V8\Uint32Value
    public function booleanValue(V8\Context $context): bool
    public function numberValue(V8\Context $context): float
    public function integerValue(V8\Context $context): float
    public function int32Value(V8\Context $context): int
    public function uint32Value(V8\Context $context): int
    public function equals(V8\Context $context, V8\Value $that): ?bool
    public function strictEquals(V8\Value $that): bool
    public function sameValue(V8\Value $that): bool
    public function typeOf(): V8\StringValue
    public function instanceOf(V8\Context $context, V8\ObjectValue $object): bool

abstract class V8\PrimitiveValue
    extends V8\Value
    abstract public function value()

class V8\UndefinedValue
    extends V8\PrimitiveValue
    public function __construct(V8\Isolate $isolate)
    public function value(): null

class V8\NullValue
    extends V8\PrimitiveValue
    public function __construct(V8\Isolate $isolate)
    public function value(): null

class V8\BooleanValue
    extends V8\PrimitiveValue
    public function __construct(V8\Isolate $isolate, bool $value)
    public function value(): bool

abstract class V8\NameValue
    extends V8\PrimitiveValue
    public function getIdentityHash(): int

class V8\StringValue
    extends V8\NameValue
    const MAX_LENGTH = 1073741799
    public function __construct(V8\Isolate $isolate, $data)
    public function value(): string
    public function length(): int
    public function utf8Length(): int
    public function isOneByte(): bool
    public function containsOnlyOneByte(): bool

class V8\SymbolValue
    extends V8\NameValue
    public function __construct(V8\Isolate $isolate, ?V8\StringValue $name)
    public function value(): string
    public function name(): V8\Value
    public static function createFor(V8\Context $context, V8\StringValue $name): V8\SymbolValue
    public static function createForApi(V8\Context $context, V8\StringValue $name): V8\SymbolValue
    public static function getHasInstanceSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getIsConcatSpreadableSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getIteratorSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getMatchSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getReplaceSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getSearchSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getSplitSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getToPrimitiveSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getToStringTagSymbol(V8\Isolate $isolate): V8\SymbolValue
    public static function getUnscopablesSymbol(V8\Isolate $isolate): V8\SymbolValue

class V8\NumberValue
    extends V8\PrimitiveValue
    public function __construct(V8\Isolate $isolate, float $value)
    public function value()

class V8\IntegerValue
    extends V8\NumberValue
    public function __construct(V8\Isolate $isolate, int $value)
    public function value(): int

class V8\Int32Value
    extends V8\IntegerValue
    public function __construct(V8\Isolate $isolate, int $value)
    public function value(): int

class V8\Uint32Value
    extends V8\IntegerValue
    public function __construct(V8\Isolate $isolate, int $value)
    public function value(): int

class V8\ObjectValue
    extends V8\Value
    implements V8\AdjustableExternalMemoryInterface
    private $context
    public function __construct(V8\Context $context)
    public function getContext(): V8\Context
    public function set(V8\Context $context, V8\Value $key, V8\Value $value)
    public function createDataProperty(V8\Context $context, V8\NameValue $key, V8\Value $value): bool
    public function defineOwnProperty(V8\Context $context, V8\NameValue $key, V8\Value $value, $attributes): bool
    public function get(V8\Context $context, V8\Value $key): V8\Value
    public function getPropertyAttributes(V8\Context $context, V8\StringValue $key): int
    public function getOwnPropertyDescriptor(V8\Context $context, V8\StringValue $key): V8\Value
    public function has(V8\Context $context, V8\Value $key): bool
    public function delete(V8\Context $context, V8\Value $key): bool
    public function setAccessor(V8\Context $context, V8\NameValue $name, callable $getter, ?callable $setter, int $settings, int $attributes): bool
    public function setAccessorProperty(V8\NameValue $name, V8\FunctionObject $getter, V8\FunctionObject $setter, int $attributes, int $settings)
    public function setNativeDataProperty(V8\Context $context, V8\NameValue $name, callable $getter, ?callable $setter, int $attributes): bool
    public function setLazyDataProperty(V8\Context $context, V8\NameValue $name, callable $getter, int $attributes): bool
    public function getPropertyNames(V8\Context $context, int $mode, int $property_filter, int $index_filter, bool $convert_to_strings): V8\ArrayObject
    public function getOwnPropertyNames(V8\Context $context, int $filter, bool $convert_to_strings): V8\ArrayObject
    public function getPrototype(): V8\Value
    public function setPrototype(V8\Context $context, V8\Value $prototype): bool
    public function findInstanceInPrototypeChain(V8\FunctionTemplate $tmpl): V8\ObjectValue
    public function objectProtoToString(V8\Context $context): V8\StringValue
    public function getConstructorName(): V8\StringValue
    public function setIntegrityLevel(V8\Context $context, int $level): bool
    public function hasOwnProperty(V8\Context $context, V8\NameValue $key): bool
    public function hasRealNamedProperty(V8\Context $context, V8\NameValue $key): bool
    public function hasRealIndexedProperty(V8\Context $context, int $index): bool
    public function hasRealNamedCallbackProperty(V8\Context $context, V8\NameValue $key): bool
    public function getRealNamedPropertyInPrototypeChain(V8\Context $context, V8\NameValue $key): V8\Value
    public function getRealNamedPropertyAttributesInPrototypeChain(V8\Context $context, V8\NameValue $key): int
    public function getRealNamedProperty(V8\Context $context, V8\NameValue $key): V8\Value
    public function getRealNamedPropertyAttributes(V8\Context $context, V8\NameValue $key): int
    public function hasNamedLookupInterceptor(): bool
    public function hasIndexedLookupInterceptor(): bool
    public function getIdentityHash(): int
    public function clone(): V8\ObjectValue
    public function isCallable(): bool
    public function isConstructor(): bool
    public function callAsFunction(V8\Context $context, V8\Value $recv, array $arguments): V8\Value
    public function callAsConstructor(V8\Context $context, array $arguments): V8\Value
    public function adjustExternalAllocatedMemory(int $change_in_bytes): int
    public function getExternalAllocatedMemory(): int

class V8\FunctionObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, callable $callback, int $length)
    public function newInstance(V8\Context $context, array $arguments): V8\ObjectValue
    public function call(V8\Context $context, V8\Value $recv, array $arguments): V8\Value
    public function setName(V8\StringValue $name)
    public function getName(): V8\Value
    public function getInferredName(): V8\Value
    public function getDisplayName(): V8\Value
    public function getScriptLineNumber(): ?int
    public function getScriptColumnNumber(): ?int
    public function getScriptId(): ?int
    public function getBoundFunction(): V8\Value
    public function getScriptOrigin(): V8\ScriptOrigin

class V8\ArrayObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, int $length)
    public function length(): int

class V8\MapObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context)
    public function size(): float
    public function clear()
    public function get(V8\Context $context, V8\Value $key): V8\Value
    public function set(V8\Context $context, V8\Value $key, V8\Value $value): V8\MapObject
    public function has(V8\Context $context, V8\Value $key): bool
    public function delete(V8\Context $context, V8\Value $key): bool
    public function asArray(): V8\ArrayObject

class V8\SetObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context)
    public function size(): float
    public function clear()
    public function add(V8\Context $context, V8\Value $key): V8\SetObject
    public function has(V8\Context $context, V8\Value $key): bool
    public function delete(V8\Context $context, V8\Value $key): bool
    public function asArray(): V8\ArrayObject

class V8\DateObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, float $time)
    public function valueOf(): float
    public static function dateTimeConfigurationChangeNotification(V8\isolate $isolate)

class V8\RegExpObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    const FLAG_NONE = 0
    const FLAG_GLOBAL = 1
    const FLAG_IGNORE_CASE = 2
    const FLAG_MULTILINE = 4
    const FLAG_STICKY = 8
    const FLAG_UNICODE = 16
    const FLAG_DOTALL = 32
    public function __construct(V8\Context $context, V8\StringValue $context, ?int $flags)
    public function getSource(): V8\StringValue
    public function getFlags(): int

class V8\PromiseObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    const STATE_PENDING = 0
    const STATE_FULFILLED = 1
    const STATE_REJECTED = 2
    public function __construct(V8\Context $context)
    public function catch(V8\Context $context, V8\FunctionObject $handler): V8\PromiseObject
    public function then(V8\Context $context, V8\FunctionObject $handler): V8\PromiseObject
    public function hasHandler(): bool
    public function result(): V8\Value
    public function state(): int

class V8\PromiseObject\ResolverObject
    extends V8\PromiseObject
    implements V8\AdjustableExternalMemoryInterface
    const STATE_PENDING = 0
    const STATE_FULFILLED = 1
    const STATE_REJECTED = 2
    public function __construct(V8\Context $context)
    public function resolve(V8\Context $context, V8\Value $value)
    public function reject(V8\Context $context, V8\Value $value)

class V8\ProxyObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, V8\ObjectValue $target, V8\ObjectValue $handler)
    public function getTarget(): ?V8\ObjectValue
    public function getHandler(): ?V8\ObjectValue
    public function isRevoked(): bool
    public function revoke()

class V8\NumberObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, $value)
    public function valueOf(): float

class V8\BooleanObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, bool $value)
    public function valueOf(): bool

class V8\StringObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, V8\StringValue $value)
    public function valueOf(): V8\StringValue

class V8\SymbolObject
    extends V8\ObjectValue
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Context $context, V8\SymbolValue $value)
    public function valueOf(): V8\SymbolValue

abstract class V8\Template
    extends V8\Data
    private $isolate
    abstract public function getIsolate(): V8\Isolate
    abstract public function set(V8\NameValue $name, V8\Data $value, int $attributes)
    abstract public function setAccessorProperty(V8\NameValue $name, V8\FunctionTemplate $getter, V8\FunctionTemplate $setter, int $attributes, int $settings)
    abstract public function setNativeDataProperty(V8\NameValue $name, callable $getter, ?callable $setter, int $attributes, ?V8\FunctionTemplate $receiver, int $settings)
    abstract public function setLazyDataProperty(V8\NameValue $name, callable $getter, int $attributes)

class V8\ObjectTemplate
    extends V8\Template
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Isolate $isolate, ?V8\FunctionTemplate $constructor)
    public function getIsolate(): V8\Isolate
    public function set(V8\NameValue $name, V8\Data $value, int $attributes)
    public function setAccessorProperty(V8\NameValue $name, V8\FunctionTemplate $getter, V8\FunctionTemplate $setter, int $attributes, int $settings)
    public function setNativeDataProperty(V8\NameValue $name, callable $getter, ?callable $setter, int $attributes, ?V8\FunctionTemplate $receiver, int $settings)
    public function setLazyDataProperty(V8\NameValue $name, callable $getter, int $attributes)
    public function newInstance(V8\Context $value): V8\ObjectValue
    public function setAccessor(V8\NameValue $name, callable $getter, ?callable $setter, int $settings, int $attributes, ?V8\FunctionTemplate $receiver)
    public function setHandlerForNamedProperty(V8\NamedPropertyHandlerConfiguration $configuration)
    public function setHandlerForIndexedProperty(V8\IndexedPropertyHandlerConfiguration $configuration)
    public function setCallAsFunctionHandler($callback)
    public function isImmutableProto(): bool
    public function setImmutableProto()
    public function adjustExternalAllocatedMemory(int $change_in_bytes): int
    public function getExternalAllocatedMemory(): int

class V8\FunctionTemplate
    extends V8\Template
    implements V8\AdjustableExternalMemoryInterface
    public function __construct(V8\Isolate $isolate, ?callable $callback, ?V8\FunctionTemplate $receiver, int $length, int $behavior)
    public function getIsolate(): V8\Isolate
    public function set(V8\NameValue $name, V8\Data $value, int $attributes)
    public function setAccessorProperty(V8\NameValue $name, V8\FunctionTemplate $getter, V8\FunctionTemplate $setter, int $attributes, int $settings)
    public function setNativeDataProperty(V8\NameValue $name, callable $getter, ?callable $setter, int $attributes, ?V8\FunctionTemplate $receiver, int $settings)
    public function setLazyDataProperty(V8\NameValue $name, callable $getter, int $attributes)
    public function getFunction(V8\Context $context): V8\FunctionObject
    public function setCallHandler(callable $callback)
    public function setLength(int $length)
    public function instanceTemplate(): V8\ObjectTemplate
    public function inherit(V8\FunctionTemplate $parent)
    public function prototypeTemplate(): V8\ObjectTemplate
    public function setClassName(V8\StringValue $name)
    public function setAcceptAnyReceiver(bool $value)
    public function setHiddenPrototype(bool $value)
    public function readOnlyPrototype()
    public function removePrototype()
    public function hasInstance(V8\ObjectValue $object): bool
    public function adjustExternalAllocatedMemory(int $change_in_bytes): int
    public function getExternalAllocatedMemory(): int

class V8\ReturnValue
    private $isolate
    private $context
    public function get(): V8\Value
    public function set(V8\Value $value)
    public function setNull()
    public function setUndefined()
    public function setEmptyString()
    public function setBool(bool $value)
    public function setInteger(int $i)
    public function setFloat(float $i)
    public function getIsolate(): V8\Isolate
    public function getContext(): V8\Context
    public function inContext(): bool

interface V8\CallbackInfoInterface
    abstract public function getIsolate(): V8\Isolate
    abstract public function getContext(): V8\Context
    abstract public function this(): V8\ObjectValue
    abstract public function holder(): V8\ObjectValue
    abstract public function getReturnValue(): V8\ReturnValue

class V8\PropertyCallbackInfo
    implements V8\CallbackInfoInterface
    private $isolate
    private $context
    private $this
    private $holder
    private $return_value
    private $should_throw_on_error
    public function getIsolate(): V8\Isolate
    public function getContext(): V8\Context
    public function this(): V8\ObjectValue
    public function holder(): V8\ObjectValue
    public function getReturnValue(): V8\ReturnValue
    public function shouldThrowOnError(): bool

class V8\FunctionCallbackInfo
    implements V8\CallbackInfoInterface
    private $isolate
    private $context
    private $this
    private $holder
    private $return_value
    private $arguments
    private $new_target
    private $is_constructor_call
    public function getIsolate(): V8\Isolate
    public function getContext(): V8\Context
    public function this(): V8\ObjectValue
    public function holder(): V8\ObjectValue
    public function getReturnValue(): V8\ReturnValue
    public function length(): int
    public function arguments(): array
    public function newTarget(): V8\Value
    public function isConstructCall(): bool

class V8\NamedPropertyHandlerConfiguration
    public function __construct(callable $getter, ?callable $setter, ?callable $query, ?callable $deleter, ?callable $enumerator, int $flags)

class V8\IndexedPropertyHandlerConfiguration
    public function __construct(callable $getter, ?callable $setter, ?callable $query, ?callable $deleter, ?callable $enumerator, int $flags)

class V8\JSON
    public static function parse(V8\Context $context, V8\StringValue $json_string): V8\Value
    public static function stringify(V8\Context $context, V8\Value $json_value, ?V8\StringValue $gap): string


text:
Simple file upload
==================

This is the simplest upload field type. It shows an upload link and can display the uploaded filename with a download link when the upload was successful.

~~~ php

use Jb\Bundle\FileUploaderBundle\Form\Type\FileAjaxType;

$builder->add('file', FileAjaxType::class, array(
    'endpoint' => 'my_endpoint_name'
));
~~~

The available options are :

* endpoint (_mandatory_) : a oneup fileupload mapping name
* download_link (_boolean_) : show the download link when the upload was successful
* remove_link (_boolean_) : show a remove link allowing to empty the field
* progress (_boolean_) : show a progress bar


text:
#region License
//
#endregion
using System.Linq;
using Galen.CI.Azure.Sql.Sharding.App.Revivers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PowerArgs;

namespace Galen.CI.Azure.Sql.Sharding.App.Tests
{
    [TestClass]
    public class ShardLocationsArgReviverTests
    {
        [TestMethod]
        public void CorrectlyRevivesSingleShardLocation()
        {
            const string expectedServerName = @"(localdb)\mssqllocaldb";
            const string expectedDatabaseName = "MyTestShard001";

            var actualShardLocations = ShardLocationsArgReviver.Revive(null, $"{expectedServerName}|{expectedDatabaseName}");
            Assert.IsNotNull(actualShardLocations);
            Assert.IsNotNull(actualShardLocations.Locations);
            Assert.AreEqual(1, actualShardLocations.Locations.Length);

            var actualLocation = actualShardLocations.Locations.Single();
            Assert.AreEqual(expectedServerName, actualLocation.ServerName);
            Assert.AreEqual(expectedDatabaseName, actualLocation.DatabaseName);
        }

        [TestMethod]
        public void CorrectlyRevivesSingleShardLocationWithErrantPairSeperator()
        {
            const string expectedServerName = @"(localdb)\mssqllocaldb";
            const string expectedDatabaseName = "MyTestShard001";

            var actualShardLocations = ShardLocationsArgReviver.Revive(null, $"{expectedServerName}|{expectedDatabaseName}|");
            Assert.IsNotNull(actualShardLocations);
            Assert.IsNotNull(actualShardLocations.Locations);
            Assert.AreEqual(1, actualShardLocations.Locations.Length);

            var actualLocation = actualShardLocations.Locations.Single();
            Assert.AreEqual(expectedServerName, actualLocation.ServerName);
            Assert.AreEqual(expectedDatabaseName, actualLocation.DatabaseName);
        }

        [TestMethod]
        public void CorrectlyRevivesMutlipleShardLocations()
        {
            const string expectedServerName01 = @"(localdb)\mssqllocaldb";
            const string expectedServerName02 = @"(localdb)\.\SharedLocalDb";
            const string expectedDatabaseName01 = "MyTestShard001";
            const string expectedDatabaseName02 = "MyTestShard002";

            var argValue =
                $"{expectedServerName01}|{expectedDatabaseName01},{expectedServerName02}|{expectedDatabaseName02}";

            var actualShardLocations = ShardLocationsArgReviver.Revive(null, argValue);
            Assert.IsNotNull(actualShardLocations);
            Assert.IsNotNull(actualShardLocations.Locations);
            Assert.AreEqual(2, actualShardLocations.Locations.Length);

            var actualLocation01 = actualShardLocations.Locations[0];
            Assert.AreEqual(expectedServerName01, actualLocation01.ServerName);
            Assert.AreEqual(expectedDatabaseName01, actualLocation01.DatabaseName);

            var actualLocation02 = actualShardLocations.Locations[1];
            Assert.AreEqual(expectedServerName02, actualLocation02.ServerName);
            Assert.AreEqual(expectedDatabaseName02, actualLocation02.DatabaseName);
        }

        [TestMethod]
        public void CorrectlyReturnsNullForNullOrEmptyOrWhiteSpaceValue()
        {
            var actualNull = ShardLocationsArgReviver.Revive(null, null);
            Assert.IsNull(actualNull);

            var actualEmpty = ShardLocationsArgReviver.Revive(null, "");
            Assert.IsNull(actualNull);

            var actualWhiteSpace = ShardLocationsArgReviver.Revive(null, "\t");
            Assert.IsNull(actualNull);
        }

        [TestMethod]
        public void CorrectlyReturnsEmptyLocationsArrayForEmtpyLocationValueAndDoesNotThrowException()
        {
            var actualEmptyLocations = ShardLocationsArgReviver.Revive(null, ",");
            Assert.IsNotNull(actualEmptyLocations);
            Assert.IsNotNull(actualEmptyLocations.Locations);
            Assert.IsFalse(actualEmptyLocations.Locations.Any());
        }

        [TestMethod]
        [ExpectedException(typeof(ArgException))]
        public void ThrowsExceptionForMissingServerName()
        {
            var _ = ShardLocationsArgReviver.Revive(null, "|MyTestShard001");
        }

        [TestMethod]
        [ExpectedException(typeof(ArgException))]
        public void ThrowsExceptionForMissingDatabaseName()
        {
            var _ = ShardLocationsArgReviver.Revive(null, @"(localdb)\mssqllocaldb|");
        }

        [TestMethod]
        [ExpectedException(typeof(ArgException))]
        public void ThrowsExceptionForMissingServerNameWhenMultipleLocationsSpecified()
        {
            var _ = ShardLocationsArgReviver.Revive(null, @"(localdb)\mssqllocaldb|MyTestShard001,|MyTestShard002");
        }

        [TestMethod]
        [ExpectedException(typeof(ArgException))]
        public void ThrowsExceptionForMissingDatabaseNameWhenMultipleLocationsSpecified()
        {
            var _ = ShardLocationsArgReviver.Revive(null, @"(localdb)\mssqllocaldb|,(localdb)\mssqllocaldb|MyTestShard002");
        }
    }
}


text:
<?php

namespace FFC\Calculator;

use FFC\Calculator\Configuration\Configuration;
use FFC\Calculator\Result\MatchResult;
use FFC\Calculator\Result\Result;
use FFC\Calculator\Result\ResultFactory;
use FFC\Formation\Formation;
use FFQP\Model\Quotation;

/**
 * The calculator is used to retrieve information of a match result like:
 * - the total of magic points
 * - the defense bonus
 * - other bonus...
 */
class Calculator implements CalculatorInterface
{
    /**
     * @var Quotation[] $quotations
     */
    private $quotations = [];

    /**
     * @var Configuration $configuration
     */
    private $configuration;

    /**
     * @param Quotation[] $quotations
     * @param Configuration $configuration
     */
    public function __construct(array $quotations, Configuration $configuration)
    {
        foreach ($quotations as $quotation) {
            $this->quotations[$quotation->getCode()] = $quotation;
        }
        $this->configuration = $configuration;
    }

    /**
     * @inheritdoc
     */
    public function getSingleResult(Formation $formation): Result
    {
        $formation->setQuotations($this->quotations);
        $footballers = $formation->getWhoPlayed();

        $resultFactory = new ResultFactory();
        return $resultFactory->createResult($footballers, $this->configuration);
    }

    /**
     * @inheritdoc
     */
    public function getMatchResult(Formation $homeFormation, Formation $awayFormation): MatchResult
    {
        $homeFormation->setQuotations($this->quotations);
        $homeFootballers = $homeFormation->getWhoPlayed();

        $awayFormation->setQuotations($this->quotations);
        $awayFootballers = $awayFormation->getWhoPlayed();

        $resultFactory = new ResultFactory();
        return $resultFactory->createMatchResult($homeFootballers, $awayFootballers, $this->configuration);
    }
}


text:
var expect = require('chai').expect;
var nock = require('nock');
var sinon = require('sinon');

var Client = require('../../index');
var posts = require('../../api/v1.0.0/posts')();

describe("posts", function() {
  beforeEach(function() {
    // Stub authenticate to be always successful
    sinon.stub(Client.prototype, 'authenticate', function (done) {
      done(null, 'test_access_token');
    });
  });

  afterEach(function() {
    // Remove the stub
    Client.prototype.authenticate.restore();
  });

  describe("#index", function() {
    it("is successful", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/posts')
        .reply(200);

      posts.index(function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });

    it("can specify category name", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/categories/games/posts')
        .reply(200);

      var options = {
        category_name: 'games'
      };

      posts.index(options, function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });
  });

  describe("#all", function() {
    it("is successful", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/posts/all')
        .reply(200);

      posts.all(function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });

    it("can pass params", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/posts/all')
        .query({newer: 1})
        .reply(200);

      var options = {
        params: {
          newer: 1
        }
      };

      posts.all(options, function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });

    it("can get posts created by a user", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/users/4/posts')
        .reply(200);

      var options = {
        user: 4,
        type: 'posts'
      };

      posts.all(options, function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });

    it("can get posts made by a user", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/users/4/products')
        .reply(200);

      var options = {
        user: 4,
        type: 'products'
      };

      posts.all(options, function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });
  });

  describe("#show", function() {
    it("is successful", function(done) {
      nock('https://api.producthunt.com/v1')
        .get('/posts/1')
        .reply(200);

      var options = {
        id: 1
      };

      posts.show(options, function (err, res) {
        expect(res.statusCode).to.equal(200);
        done();
      });
    });
  });

  describe("#create", function() {
    it("is successful", function(done) {
      var options = {
        url: 'coddee.io',
        name: 'Coddee',
        tagline: 'Code review made easy'
      };

      nock('https://api.producthunt.com/v1')
        .post('/posts', {
          post: options
        })
        .reply(201);

      posts.create(options, function (err, res) {
        expect(err).to.equal(null);
        expect(res.statusCode).to.equal(201);
        done();
      });
    });
  });

  describe("#collect", function() {
    it("can add a post to a collection", function(done) {
      var options = {
        post_id: 1,
        collection_id: 1,
        type: 'add'
      };

      nock('https://api.producthunt.com/v1')
        .post('/posts/1/collect', {
          collection_id: 1
        })
        .reply(201);

      posts.collect(options, function (err, res) {
        expect(err).to.equal(null);
        expect(res.statusCode).to.equal(201);
        done();
      });
    });

    it("can remove a post from a collection", function(done) {
      var options = {
        post_id: 1,
        collection_id: 1,
        type: 'remove'
      };

      nock('https://api.producthunt.com/v1')
        .delete('/posts/1/collect', {
          collection_id: 1
        })
        .reply(200);

      posts.collect(options, function (err, res) {
        expect(err).to.equal(null);
        expect(res.statusCode).to.equal(200);
        done();
      });
    });
  });
});


text:
. $(dirname $0)/../common.sh
set -x
rm -rf $CORPUS
mkdir $CORPUS

# seed.png was generated by this command:
# onvert -background white -size 80x label:"X" -trim +repage seed.png
cp $SCRIPT_DIR/seed.png $CORPUS

test_source_location() {
  SRC_LOC="$1"
  echo "test_source_location: $SRC_LOC"
  rm -f *.log
  # This target has a 2Gb malloc oom, so we have to use rss_limit_mb=3000
  [ -e $EXECUTABLE_NAME_BASE-lf ] && \
    ./$EXECUTABLE_NAME_BASE-lf -close_fd_mask=3 -artifact_prefix=$CORPUS/ -exit_on_src_pos=$SRC_LOC  -runs=100000000 -jobs=$JOBS -workers=$JOBS $CORPUS -rss_limit_mb=3000
  grep "INFO: found line matching '$SRC_LOC'" fuzz-*.log || exit 1
}

test_source_location png.c:1035
test_source_location pngrutil.c:1041
test_source_location pngread.c:757
# The following currently require too much time to find.
#test_source_location pngrutil.c:1393
#test_source_location pngread.c:738
#test_source_location pngrutil.c:3182
#test_source_location pngrutil.c:139


text:
#pragma once

#include "../math/Matrix3x2.h"

namespace SlimDX
{
	namespace Direct2D
	{
		public value class BrushProperties
		{
		public:
			property float Opacity;
			property Matrix3x2 Transform;
		};
	}
}


text:
export default class {

  constructor(auth) {
    this.auth = auth;
  }

  /**
   * @param {class} httpRequest req
   * @param {class} httpResponse res
   * @return {void} -
   */
  process(httpRequest, httpResponse) {
    return new Promise((resolve, reject) => {
      let token = httpRequest.headers.authorization.substr(7);
      let user = this.auth.verifyToken(token);

      if (user !== false) {
        httpResponse.send({
          username: user
        });
        resolve();
      } else {
        reject();
      }
    }).catch(() => {
      httpResponse.status(401);
      httpResponse.send('Invalid user');
    });
  }
}


text:
All URIs are relative to *https://localhost/rest/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createAffiliateBlock**](MerchantsApi.md#createAffiliateBlock) | **POST** /merchants/{merchantId}/block-affiliate/ | Create merchant affiliate block
[**deleteAffiliateBlock**](MerchantsApi.md#deleteAffiliateBlock) | **DELETE** /merchants/{merchantId}/block-affiliate/{blockId}/ | Delete Merchant Affiliate Block
[**getMerchant**](MerchantsApi.md#getMerchant) | **GET** /merchants/{merchantId} | Get merchant info

# **createAffiliateBlock**
> \Swagger\Client\Model\Merchant createAffiliateBlock($merchantId, $affiliateId)

Create merchant affiliate block

Create a block which merchant does not allow affiliate sale products

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: JWT
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Authorization-JWT', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Authorization-JWT', 'Bearer');
// Configure API key authorization: API-KEY
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');

$api_instance = new Swagger\Client\Api\MerchantsApi();
$merchantId = 56; // int | Merchant group account id
$affiliateId = 56; // int | Affiliate group account id

try {
    $result = $api_instance->createAffiliateBlock($merchantId, $affiliateId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MerchantsApi->createAffiliateBlock: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **merchantId** | **int**| Merchant group account id |
 **affiliateId** | **int**| Affiliate group account id |

### Return type

[**\Swagger\Client\Model\Merchant**](../Model/Merchant.md)

### Authorization

[JWT](../../README.md#JWT), [API-KEY](../../README.md#API-KEY)

### HTTP request headers

 - **Content-Type**: application/x-www-form-urlencoded
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **deleteAffiliateBlock**
> \Swagger\Client\Model\Merchant deleteAffiliateBlock($merchantId, $blockId)

Delete Merchant Affiliate Block

Delete merchant affiliate block to make affiliate to sell merchant product again

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: JWT
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Authorization-JWT', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Authorization-JWT', 'Bearer');
// Configure API key authorization: API-KEY
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');

$api_instance = new Swagger\Client\Api\MerchantsApi();
$merchantId = 56; // int | Merchant id
$blockId = 56; // int | Block id

try {
    $result = $api_instance->deleteAffiliateBlock($merchantId, $blockId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MerchantsApi->deleteAffiliateBlock: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **merchantId** | **int**| Merchant id |
 **blockId** | **int**| Block id |

### Return type

[**\Swagger\Client\Model\Merchant**](../Model/Merchant.md)

### Authorization

[JWT](../../README.md#JWT), [API-KEY](../../README.md#API-KEY)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **getMerchant**
> \Swagger\Client\Model\MerchantDetailsResponse getMerchant($merchantId)

Get merchant info

Get merchant info

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: JWT
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Authorization-JWT', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Authorization-JWT', 'Bearer');
// Configure API key authorization: API-KEY
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');

$api_instance = new Swagger\Client\Api\MerchantsApi();
$merchantId = 56; // int | Merchant group account id

try {
    $result = $api_instance->getMerchant($merchantId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MerchantsApi->getMerchant: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **merchantId** | **int**| Merchant group account id |

### Return type

[**\Swagger\Client\Model\MerchantDetailsResponse**](../Model/MerchantDetailsResponse.md)

### Authorization

[JWT](../../README.md#JWT), [API-KEY](../../README.md#API-KEY)

### HTTP request headers

 - **Content-Type**: application/x-www-form-urlencoded
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)