text:
INIT_LOCATION;

namespace erebus {

const std::string GTK_ViewContainer::CLASSNAME="GTK_ViewContainer";

GTK_ViewContainer::GTK_ViewContainer(
    Glib::RefPtr<Gtk::Adjustment> h_adjustment,
    Glib::RefPtr<Gtk::Adjustment> v_adjustment,
    std::unique_ptr<Gtk::Notebook> notebook,IGUIManager& manager):
	Gtk::Viewport(h_adjustment,v_adjustment),timeBuffer_(0),clickBuffer_(0),isSplitted_(false),lastPageClicked_(-2) {

	LOG_CONSTRUCTOR;

	setGUIManager(manager);

	set_shadow_type(Gtk::SHADOW_NONE);

	add_events(Gdk::BUTTON_PRESS_MASK );

#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
	signal_button_press_event().connect(sigc::mem_fun(*this, &GTK_ViewContainer::on_button_press_event),
	                                    false);
#endif

	if(notebook.get()==nullptr) {
		createNoteBook();
	} else {
		notebook_=std::move(notebook);
	}

	add(*notebook_);

	buildContextMenu();
	updateContextMenu();

	show_all_children();
}

GTK_ViewContainer::~GTK_ViewContainer() {
	LOG_DESTRUCTOR;
}

void GTK_ViewContainer::createNoteBook() {
	notebook_=std::make_unique<Gtk::Notebook>();

	auto ptr=notebook_.get();

	auto updaterAdd=[=](Gtk::Widget* page, guint page_num) {
		auto pref=getGUIManager().getViewPreferences().getPreferenceBool(AlwaysShowTabsPref::KEY);

		ptr->set_show_tabs(pref||ptr->get_n_pages()>1);

		if(getGUIManager().getViewPreferences().getPreferenceBool(CloseEmptyViewWindowsPref::KEY)) {
			getGUIManager().closeEmptyViewWindows();
		}
	};

	auto updaterRemove=[=](Gtk::Widget* page, guint page_num) {

		auto pref=getGUIManager().getViewPreferences().getPreferenceBool(AlwaysShowTabsPref::KEY);

		ptr->set_show_tabs(pref||ptr->get_n_pages()>1);
	};

	notebook_->signal_page_added().connect(updaterAdd);
	notebook_->signal_page_removed().connect(updaterRemove);
	notebook_->set_group_name("notebooks");
	notebook_->set_scrollable(true);
}

void GTK_ViewContainer::on_context_menu_split_horizontal_click() {
	LOG_ASSERT_GTK(presenter_.get()!=nullptr);

	presenter_->on_context_menu_split_horizontal_click();
}

void GTK_ViewContainer::on_context_menu_split_vertical_click() {
	LOG_ASSERT_GTK(presenter_.get()!=nullptr);

	presenter_->on_context_menu_split_vertical_click();
}

void GTK_ViewContainer::showContextMenu() {
	LOG_ASSERT(gtk_l::get(), popupMenu_.get()!=nullptr);

	updateContextMenu();

	//The following has to be here and not in updateContextMenu
	//since it should only get executed when an actual click was performed
	auto parent=guiManager_->getParentOf(getID());
	if(parent!=nullptr) {
		if(parent->classname()!=GTK_ViewContainer::CLASSNAME)
			joinItem_->set_sensitive(false);
	} else {
		LOG_GTK(warning)<<"There is somewehere a bug in the getParentOf() method";
	}

	popupMenu_->popup(clickBuffer_,timeBuffer_);
}

void GTK_ViewContainer::updateContextMenu() {
	if(isSplitted())
		LOG_ASSERT(gtk_l::get(),false);

	LOG_ASSERT(gtk_l::get(),notebook_.get()!=nullptr);

	if(notebook_->get_n_pages()>=1) {
		if(lastPageClicked_!=notebook_->get_current_page()) {
			buildContextMenu();
			lastPageClicked_=notebook_->get_current_page();
			auto child=dynamic_cast<GTK_View*>(notebook_->get_nth_page(lastPageClicked_));

			if(child!=0) {
				auto child_menu=std::move(child->createContextMenu());
				auto menu_entries=child_menu->get_children();
				for(std::size_t i=0; i<menu_entries.size(); i++) {
					auto item=dynamic_cast<Gtk::MenuItem*>(menu_entries.at(i));
					if(item!=0) {
						child_menu->remove(*item);
						item->show();
						popupMenu_->insert(*Gtk::manage(item),i);
					} else {
						LOG_GTK(error)<<"Cast failed.";
					}
				}
			} else {
				LOG_GTK(error)<<"Cast failed.";
			}

			viewItem_->show();
			separator_->show();
			separator1_->show();
		}
	} else {
		lastPageClicked_=-2;
		buildContextMenu();
		viewItem_->hide();
		separator_->hide();
		separator1_->hide();
	}

}

void GTK_ViewContainer::addView(IView& view) {
	try {
		auto& view_c=dynamic_cast<GTK_View&>(view);
		addViewPr(view_c);
	} catch(const std::bad_cast& e) {
		LOG_GTK(error)<<"Cast failed.";
		throw;
	}
}

void GTK_ViewContainer::buildContextMenu() {
	LOG_ASSERT(gtk_l::get(),guiManager_!=nullptr);

	popupMenu_=std::make_unique<Gtk::Menu>();

	//Separator Item
	separator1_=std::make_unique<Gtk::SeparatorMenuItem>();
	auto sep1=Gtk::manage(new Gtk::SeparatorMenuItem);
	auto sep2=Gtk::manage(new Gtk::SeparatorMenuItem);
	auto sep3=Gtk::manage(new Gtk::SeparatorMenuItem);
	separator_=std::make_unique<Gtk::SeparatorMenuItem>();

	viewItem_=std::make_unique<Gtk::MenuItem>("View");
	auto view_c_menu=Gtk::manage(new Gtk::Menu);
	viewItem_->set_submenu(*view_c_menu);

	auto popout_item=Gtk::manage(new Gtk::MenuItem("Pop out"));
	popout_item->signal_activate().
	connect(
	    sigc::mem_fun(*this,
	                  &GTK_ViewContainer::on_context_menu_pop_out_click)
	);

	auto close_item=Gtk::manage(new Gtk::MenuItem("Close"));
	close_item->signal_activate().
	connect(
	    sigc::mem_fun(*this,
	                  &GTK_ViewContainer::on_context_menu_close_click)
	);

	//Control submenu
	auto control=Gtk::manage(new Gtk::MenuItem{"Control"});
	auto control_menu=Gtk::manage(new Gtk::Menu);
	control->set_submenu(*control_menu);

	//Join item
	joinItem_=std::make_unique<Gtk::MenuItem>("Join");
	joinItem_->signal_activate().
	connect(
	    sigc::mem_fun(*this,
	                  &GTK_ViewContainer::on_context_menu_join_click)
	);

	auto split_h = Gtk::manage(new Gtk::MenuItem{"Split Horizontal"});
	auto split_v = Gtk::manage(new Gtk::MenuItem{"Split Vertical"});

	split_h->signal_activate().
	connect(sigc::mem_fun(*this,
	                      &GTK_ViewContainer::on_context_menu_split_horizontal_click) );

	split_v->signal_activate().
	connect(sigc::mem_fun(*this,
	                      &GTK_ViewContainer::on_context_menu_split_vertical_click) );

	auto add_view = Gtk::manage(new Gtk::MenuItem{"Add View"});
	auto view_menu=Gtk::manage(new Gtk::Menu);

	auto empty_view = Gtk::manage(new Gtk::MenuItem{"Empty View"});
	view_menu->append(*empty_view);
	empty_view->signal_activate().
	connect(sigc::mem_fun(*this,
	                      &GTK_ViewContainer::on_context_menu_add_empty_view_click) );

	auto hex_view = Gtk::manage(new Gtk::MenuItem{"Hex View"});
	view_menu->append(*hex_view);
	hex_view->signal_activate().
	connect(sigc::mem_fun(*this,
	                      &GTK_ViewContainer::on_context_menu_add_hex_view_click) );

	add_view->set_submenu(*view_menu);

	popupMenu_->append(*separator_);
	view_c_menu->append(*popout_item);
	view_c_menu->append(*sep3);
	view_c_menu->append(*close_item);
	popupMenu_->append(*viewItem_);
	popupMenu_->append(*separator1_);
	control_menu->append(*joinItem_);
	control_menu->append(*sep1);
	control_menu->append(*split_h);
	control_menu->append(*split_v);
	control_menu->append(*sep2);
	control_menu->append(*add_view);
	popupMenu_->append(*control);

	popupMenu_->accelerate(*this);
	popupMenu_->show_all();
}

void GTK_ViewContainer::on_context_menu_close_click() {
	LOG_ASSERT(gtk_l::get(),presenter_.get()!=nullptr);

	presenter_->on_context_menu_close_click();
}

void GTK_ViewContainer::closeActiveView() {
	LOG_ASSERT(gtk_l::get(),!isSplitted());
	LOG_ASSERT(gtk_l::get(),notebook_.get()!=nullptr);
	LOG_ASSERT(gtk_l::get(),notebook_->get_n_pages()>=1);

	auto activeView=notebook_->get_nth_page(notebook_->get_current_page());
	auto activeViewC=dynamic_cast<IView*>(activeView);
	if(activeViewC==0) {
		LOG_GTK(error)<<"Cast failed.";
		return;
	}
	closeView(*activeViewC);
}

void GTK_ViewContainer::join() {
	if(!isSplitted())
		return;
	isSplitted_=false;

	LOG_GTK(normal)<<"Joining view container '"<<getID()<<"'";

	LOG_ASSERT_GTK(paned_.get()!=nullptr);
	LOG_ASSERT_GTK(child1_.get()!=nullptr);
	LOG_ASSERT_GTK(child2_.get()!=nullptr);
	LOG_ASSERT_GTK(notebook_.get()==nullptr);

	if(!child1_->isTopLevel()) {
		child1_->join();
	}
	if(!child2_->isTopLevel()) {
		child2_->join();
	}

	createNoteBook();

	LOG_ASSERT_GTK(child1_->notebook_.get()!=nullptr);

	for(auto it:child1_->notebook_->get_children()) {
		auto buffer=dynamic_cast<GTK_View*>(it);

		if(buffer==0) {
			LOG_GTK(error)<<LOCATION<<"Cast failed.";
			continue;
		}

		child1_->notebook_->remove(*it);

		addView(*buffer);
	}

	LOG_ASSERT(gtk_l::get(),child2_->notebook_.get()!=nullptr);

	for(auto it:child2_->notebook_->get_children()) {
		auto buffer=dynamic_cast<GTK_View*>(it);

		if(buffer==0) {
			LOG_GTK(error)<<LOCATION<<"Cast failed.";
			continue;
		}

		child2_->notebook_->remove(*it);

		addView(*buffer);
	}

	paned_->remove(*(child1_.get()));
	paned_->remove(*(child2_.get()));
	Gtk::Container::remove(*(paned_.get()));
	paned_=std::unique_ptr<Gtk::Paned>(nullptr);
	child1_=std::unique_ptr<GTK_ViewContainer>(nullptr);
	child2_=std::unique_ptr<GTK_ViewContainer>(nullptr);

	show_all_children();

	add(*notebook_);

	show_all_children();
}

void GTK_ViewContainer::on_context_menu_add_empty_view_click() {
	LOG_ASSERT(gtk_l::get(), presenter_.get()!=nullptr);

	presenter_->on_context_menu_add_view_click(ViewType::EMPTY_VIEW);
}

void GTK_ViewContainer::on_context_menu_add_hex_view_click() {
	LOG_ASSERT(gtk_l::get(), presenter_.get()!=nullptr);

	presenter_->on_context_menu_add_view_click(ViewType::HEX_VIEW);
}

void GTK_ViewContainer::on_context_menu_join_click() {
	LOG_ASSERT(gtk_l::get(), presenter_.get()!=nullptr);

	presenter_->on_context_menu_join_click();
}

void GTK_ViewContainer::setPresenter(std::unique_ptr<IViewContainerPresenter> presenter) {
	LOG_ASSERT(gtk_l::get(),presenter.get()!=nullptr);

	presenter_=std::move(presenter);
}

void GTK_ViewContainer::on_context_menu_pop_out_click() {
	LOG_ASSERT_GTK(presenter_.get()!=nullptr);

	presenter_->on_context_menu_pop_out_click();
}

IView* GTK_ViewContainer::getActiveView() {
	LOG_ASSERT_GTK(notebook_.get()!=nullptr);

	if(notebook_->get_n_pages()==0)
		return nullptr;

	auto view=dynamic_cast<IView*>(notebook_->get_nth_page(notebook_->get_current_page()));

	if(view==0) {
		LOG_GTK(error)<<"Cast failed.";
		return nullptr;
	}
	return view;
}

void GTK_ViewContainer::removeView(IView& view) {
	try {
		auto& buffer=dynamic_cast<Gtk::Viewport&>(view);
		notebook_->remove(buffer);
	} catch(std::bad_cast e) {
		LOG_GTK(error)<<"Cast failed.";
		throw;
	}
	show_all_children();
}

bool GTK_ViewContainer::on_button_press_event(GdkEventButton *ev) {
	LOG_ASSERT(gtk_l::get(), presenter_.get()!=nullptr);

	bool return_value = false;
	return_value = Viewport::on_button_press_event(ev);

	if( (ev->type == GDK_BUTTON_PRESS)) {
		switch(ev->button) {
		case 3:
			timeBuffer_=ev->time;
			clickBuffer_=3;
			presenter_->on_right_button_click();
			break;
		case 1:
			timeBuffer_=ev->time;
			clickBuffer_=1;
			presenter_->on_left_button_click();
			break;
		default:
			;
		};

	}
	return return_value;
}

bool GTK_ViewContainer::containsWidget(std::size_t id) {
	if(isSplitted()) {
		LOG_ASSERT(gtk_l::get(),child1_.get()!=nullptr);
		LOG_ASSERT(gtk_l::get(),child2_.get()!=nullptr);

		if(child1_->getID()==id||child2_->getID()==id)
			return true;

		return child1_->containsWidget(id)||child2_->containsWidget(id);
	} else {
		LOG_ASSERT(gtk_l::get(),notebook_.get()!=nullptr);

		for(auto it:notebook_->get_children()) {
			auto buffer=dynamic_cast<IGUIObject*>(it);
			if(buffer==0) {
				LOG_GTK(error)<<"Cast failed.";
				continue;
			} else if(buffer->getID()==id) {
				return true;
			}
		}
	}
	return false;
}

void GTK_ViewContainer::closeView(IView& view) {
	try {
		auto& buffer=dynamic_cast<GTK_View&>(view);
		notebook_->remove_page(buffer);
		if(getGUIManager().getViewPreferences().getPreferenceBool(CloseEmptyViewWindowsPref::KEY)) {
			getGUIManager().closeEmptyViewWindows();
		}
	} catch(std::bad_cast e) {
		LOG_GTK(error)<<"Cast failed.";
		throw;
	}
}

bool GTK_ViewContainer::isTopLevel() const {
	return !isSplitted();
}

bool GTK_ViewContainer::isEmpty() {
	if(isSplitted()) {
		LOG_ASSERT_GTK(child1_.get()!=nullptr);
		LOG_ASSERT_GTK(child2_.get()!=nullptr);

		return child1_->isEmpty()&&child2_->isEmpty();
	}

	LOG_ASSERT_GTK(notebook_.get()!=nullptr);

	return notebook_->get_n_pages()==0;
}

bool GTK_ViewContainer::isSplitted() const {
	return isSplitted_;
}

void GTK_ViewContainer::split() {
	if(isSplitted()) {
		LOG_ASSERT(gtk_l::get(),false);
		return;
	}

	isSplitted_=true;

	LOG_ASSERT(gtk_l::get(),paned_.get()!=nullptr);
	LOG_ASSERT(gtk_l::get(),guiManager_!=nullptr);
	LOG_ASSERT(gtk_l::get(),notebook_.get()!=nullptr);

	Gtk::Container::remove(*notebook_);

	child1_=GTK_ViewContainerFactory::createViewContainer<ViewContainerPresenter>(*guiManager_,
	        get_hadjustment(),
	        get_vadjustment(),std::move(notebook_));
	child2_=GTK_ViewContainerFactory::createViewContainer<ViewContainerPresenter>(*guiManager_,
	        get_hadjustment(),
	        get_vadjustment());

	paned_->pack1(*(child1_.get()),true,false);
	paned_->pack2(*(child2_.get()),true,false);

	add(*paned_);

	show_all_children();
}

void GTK_ViewContainer::splitHorizontal() {
	if(isSplitted())
		return;

	LOG_GTK(normal)<<"Splitting "<<classname()<<" '"<<getID()<<"' horizontally";

	paned_=std::make_unique<Gtk::Paned>( Gtk::ORIENTATION_HORIZONTAL);
	auto rec=get_allocation();
	paned_->set_position(rec.get_width()/2);

	split();
}
void GTK_ViewContainer::splitVertical() {
	if(isSplitted())
		return;

	LOG_GTK(normal)<<"Splitting "<<classname()<<" '"<<getID()<<"' vertically";

	paned_=std::make_unique<Gtk::Paned>( Gtk::ORIENTATION_VERTICAL);
	auto rec=get_allocation();
	paned_->set_position(rec.get_height()/2);

	split();
}

void GTK_ViewContainer::addView(ViewType type) {

	switch(type) {
	case ViewType::EMPTY_VIEW: {
		auto title=std::string{"Empty View"};

		auto view=GTK_ViewFactory::createView<GTK_EmptyView,EmptyViewPresenter>(*guiManager_,
		          ViewType::EMPTY_VIEW);
		view->setTitle(title);
		addViewPr(*view);
		break;
	}
	case ViewType::HEX_VIEW: {
		auto title=std::string{"Hex View"};

		auto view=GTK_ViewFactory::createView<GTK_HexView,HexViewPresenter>(*guiManager_,
		          ViewType::HEX_VIEW);
		view->setTitle(title);
		addViewPr(*view);
		break;
	}

	default:
		;
	}
}

void GTK_ViewContainer::addViewPr(GTK_View& view) {
	LOG_ASSERT_GTK(isTopLevel());
	LOG_ASSERT_GTK(notebook_.get()!=nullptr);

	notebook_->append_page(view,view.getTitle());
	notebook_->set_tab_reorderable(view);
	notebook_->set_tab_detachable(view);

	show_all_children();
}

IGUIObject* GTK_ViewContainer::getParentOf(std::size_t id) {
	if(!containsWidget(id))
		return nullptr;

	if(isSplitted()) {
		LOG_ASSERT(gtk_l::get(),child1_.get()!=nullptr);
		LOG_ASSERT(gtk_l::get(),child2_.get()!=nullptr);

		auto ch1=child1_->getParentOf(id);
		auto ch2=child2_->getParentOf(id);

		if(ch1==nullptr&&ch2==nullptr) {
			return this;
		}

		return ch1==nullptr?ch2:ch1;
	} else {
		if(containsWidget(id)) {
			return this;
		}
	}

	return nullptr;
}

std::size_t GTK_ViewContainer::getID() {
	return reinterpret_cast<std::size_t>(this);
}

std::string GTK_ViewContainer::classname() {
	return CLASSNAME;
}

void GTK_ViewContainer::setGUIManager(IGUIManager& manager) {
	guiManager_=&manager;
}

IGUIManager& GTK_ViewContainer::getGUIManager() {
	LOG_ASSERT(gtk_l::get(),guiManager_!=nullptr);
	return *guiManager_;
}

}//namespace erebus


text:
<?php

namespace EscapeWork\LaravelUploader\Jobs;

use EscapeWork\LaravelUploader\Collections\UploadCollection;
use Illuminate\Contracts\Bus\SelfHandling;

class UploadJob extends Job implements SelfHandling
{

    public $dir;
    private $files;

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct($files, $dir)
    {
        $this->files = $files;
        $this->dir   = $dir;
    }

    public function files(UploadCollection $files = null)
    {
        if (is_null($files)) {
            return $this->files;
        }

        $this->files = $files;
    }

    /**
     * Handle the command.
     *
     * @return void
     */
    public function handle()
    {
        return $this->files;
    }
}

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

describe 'Explore Groups page', :js do
  let!(:user) { create :user }
  let!(:group) { create(:group) }
  let!(:public_group) { create(:group, :public) }
  let!(:private_group) { create(:group, :private) }
  let!(:empty_project) { create(:project, group: public_group) }

  before do
    group.add_owner(user)

    sign_in(user)

    visit explore_groups_path
  end

  it 'shows groups user is member of' do
    expect(page).to have_content(group.full_name)
    expect(page).to have_content(public_group.full_name)
    expect(page).not_to have_content(private_group.full_name)
  end

  it 'filters groups' do
    fill_in 'filter_groups', with: group.name
    wait_for_requests

    expect(page).to have_content(group.full_name)
    expect(page).not_to have_content(public_group.full_name)
    expect(page).not_to have_content(private_group.full_name)
  end

  it 'resets search when user cleans the input' do
    fill_in 'filter_groups', with: group.name
    wait_for_requests

    fill_in 'filter_groups', with: ""
    wait_for_requests

    expect(page).to have_content(group.full_name)
    expect(page).to have_content(public_group.full_name)
    expect(page).not_to have_content(private_group.full_name)
    expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2
  end

  it 'shows non-archived projects count' do
    # Initially project is not archived
    expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1")

    # Archive project
    empty_project.archive!
    visit explore_groups_path

    # Check project count
    expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("0")

    # Unarchive project
    empty_project.unarchive!
    visit explore_groups_path

    # Check project count
    expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1")
  end

  describe 'landing component' do
    it 'should show a landing component' do
      expect(page).to have_content('Below you will find all the groups that are public.')
    end

    it 'should be dismissable' do
      find('.dismiss-button').click

      expect(page).not_to have_content('Below you will find all the groups that are public.')
    end

    it 'should persistently not show once dismissed' do
      find('.dismiss-button').click

      visit explore_groups_path

      expect(page).not_to have_content('Below you will find all the groups that are public.')
    end
  end
end


text:
using System;

namespace Entr.Domain.Tests;

[EntityId<int>]
public partial struct PersonId { }

[EntityId<int>]
public partial struct DogId { }

partial class EntityTests
{
    public class Person : Entity<PersonId>
    {
        public Person(PersonId id)
        {
            Id = id;
        }

        public void SetId(PersonId id)
        {
            Id = id;
        }
    }

    public class Dog : Entity<DogId>
    {
        public Dog(DogId id)
        {
            Id = id;
        }
    }
}


text:
package main

import (
	"fmt"
	"github.com/mcroydon/timex"
)

func main() {
	tmx := timex.Now()
	fmt.Printf("Current time: %v\nStatus: %v\nMax error: %v\nEstimated error: %v\n", tmx.Time, tmx.StatusInfo(), tmx.Maxerror, tmx.Esterror)
}


text:
package org.shypl.biser.csi.server;

import org.shypl.biser.csi.Address;

public interface ChannelGate {
	void open(Address address, ChannelAcceptor acceptor);

	void close();
}


text:
package com.bulain.netty.push;

import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.bulain.netty.push.pojo.Printer;

public class PushChannels {
    private static Map<Printer, Channel> printers = new ConcurrentHashMap<Printer, Channel>();

    public static boolean containsKey(Printer key){
        return printers.containsKey(key);
    }

    public static void put(Printer key, Channel value){
        printers.put(key, value);
    }

    public static ChannelFuture writeAndFlush(Printer printer, Object msg) {
        ChannelFuture future = null;
        Channel channel = printers.get(printer);
        if (channel != null && channel.isWritable()) {
            future = channel.writeAndFlush(msg);
        }
        return future;
    }

}


text:
  case enum:                 \
    return #enum

namespace media {
namespace cast {

const char* CastLoggingToString(CastLoggingEvent event) {
  switch (event) {
    ENUM_TO_STRING(UNKNOWN);
    ENUM_TO_STRING(FRAME_CAPTURE_BEGIN);
    ENUM_TO_STRING(FRAME_CAPTURE_END);
    ENUM_TO_STRING(FRAME_ENCODED);
    ENUM_TO_STRING(FRAME_ACK_RECEIVED);
    ENUM_TO_STRING(FRAME_ACK_SENT);
    ENUM_TO_STRING(FRAME_DECODED);
    ENUM_TO_STRING(FRAME_PLAYOUT);
    ENUM_TO_STRING(PACKET_SENT_TO_NETWORK);
    ENUM_TO_STRING(PACKET_RETRANSMITTED);
    ENUM_TO_STRING(PACKET_RTX_REJECTED);
    ENUM_TO_STRING(PACKET_RECEIVED);
  }
  NOTREACHED();
  return "";
}

FrameEvent::FrameEvent()
    : width(0),
      height(0),
      size(0u),
      type(UNKNOWN),
      media_type(UNKNOWN_EVENT),
      key_frame(false),
      target_bitrate(0),
      encoder_cpu_utilization(-1.0),
      idealized_bitrate_utilization(-1.0) {}
FrameEvent::FrameEvent(const FrameEvent& other) = default;
FrameEvent::~FrameEvent() {}

PacketEvent::PacketEvent()
    : max_packet_id(0),
      packet_id(0),
      size(0),
      type(UNKNOWN),
      media_type(UNKNOWN_EVENT) {}
PacketEvent::~PacketEvent() {}

}  // namespace cast
}  // namespace media


text:
<?php
namespace Edu\Cnm\Sprots;

require_once("autoload.php");

/**
 * Player Statistics, This will be a player stat that is being pulled from APIs.
 * @author Chris Paul <chrispaul3625@gmail.com>
 **/
class PlayerStatistic implements \JsonSerializable {

	use ValidateDate;
	/**
	 * $playerStatisticGameId id for player in a specific game; this is a foreign key
	 * @var int $playerStatisticGameId
	 **/
	private $playerStatisticGameId;
	/**
	 * $playerStatisticPlayerId id for players overall statistics, this is a foreign key
	 * @var int $playerStatisticPlayerId
	 **/
	private $playerStatisticPlayerId;
	/**
	 * $playerStatisticTeamId id for players statistic to team , this is a foreign key
	 * @var int $playerStatisticTeamId
	 **/
	private $playerStatisticTeamId;
	/**
	 * $playerStatisticStatisticId id for the players individual statistic, this is a foreign key
	 * @var int $playerStatisticStatisticId
	 **/
	private $playerStatisticStatisticId;
	/**
	 * $playerStatisticValue the value of individual stats, number value for a stat
	 * @var int $playerStatisticValue
	 **/
	private $playerStatisticValue;

	/**
	 * Constructor for this players statistics
	 *
	 * @param int $newPlayerStatisticGameId id of game the player is in
	 * @param int $newPlayerStatisticPlayerId statistic id of the player
	 * @param int $newPlayerStatisticTeamId statistic id of the player referencing team
	 * @param int $newPlayerStatisticStatisticId name associated with team
	 * @param string $newPlayerStatisticValue Value of the statistic
	 * @throws \InvalidArgumentException if data types are not valid
	 * @throws \RangeException if data values are out of bounds (e.g., strings too long, negative integers)
	 * @throws \TypeError if data types violate type hints
	 * @throws \Exception if some other exception occurs
	 **/

	public function __construct(int $newPlayerStatisticGameId, int $newPlayerStatisticPlayerId, int $newPlayerStatisticTeamId, int $newPlayerStatisticStatisticId, string $newPlayerStatisticValue) {
		try {
			$this->setPlayerStatisticGameId($newPlayerStatisticGameId);
			$this->setPlayerStatisticPlayerId($newPlayerStatisticPlayerId);
			$this->setPlayerStatisticTeamId($newPlayerStatisticTeamId);
			$this->setPlayerStatisticStatisticId($newPlayerStatisticStatisticId);
			$this->setPlayerStatisticValue($newPlayerStatisticValue);
		} catch(\InvalidArgumentException $InvalidArgument) {
			// Rethrow the exception to the caller
			throw(new \InvalidArgumentException($InvalidArgument->getmessage(), 0, $InvalidArgument));
		} catch(\RangeException $range) {
			// Rethrow the exception to the caller
			throw(new \RangeException($range->getMessage(), 0, $range));
		} catch(\TypeError $typeError) {
			throw(new \TypeError($typeError->getMessage(), 0, $typeError));
		}
	}

	/**
	 * accessor method for Player Statistic Game Id
	 *
	 * @return int|null value of Player Statistic Game Id
	 **/
	public function getPlayerStatisticGameId() {
		return ($this->playerStatisticGameId);
	}

	/**
	 * mutator method for PlayerStatisticGameId
	 *
	 * @param int|null $newPlayerStatisticGameId new value of Player Statistic Game Id
	 * @throws \RangeException if the $newPlayerStatisticGameId is not positive
	 * @throws \TypeError if $newPlayerStatisticGameId is not an integer
	 **/
	public function setPlayerStatisticGameId(int $newPlayerStatisticGameId) {
		if($newPlayerStatisticGameId === null) {
			throw(new \InvalidArgumentException("Id cannot be null"));
		}
		// Verify the PlayerStatisticGameId is positive
		if($newPlayerStatisticGameId <= 0) {
			throw(new \RangeException("PlayerStatisticGameId is not positive"));
		}
		// Convert and store the PlayerStatisticGameId
		$this->playerStatisticGameId = $newPlayerStatisticGameId;
	}

	/**
	 *accessor method for Player Statistic Player Id
	 *
	 * @return int|null value of Player Statistic Player Id
	 **/
	public function getPlayerStatisticPlayerId() {
		return ($this->playerStatisticPlayerId);
	}

	/**
	 * mutator method for Player Statistic Player Id
	 *
	 * @param int|null $newPlayerStatisticPlayerId new value of Player Statistic Player Id
	 * @throws \RangeException if the $newPlayerStatisticPlayerId is not positive
	 * @throws \TypeError if $newPlayerStatisticPlayerId is not an integer
	 **/
	public function setPlayerStatisticPlayerId(int $newPlayerStatisticPlayerId = null) {
		// base case: if PlayerStatisticPlayerId is null, this is a new player statistic player id without a MySQL assigned id (yet)
		if($newPlayerStatisticPlayerId === null) {
			throw(new \InvalidArgumentException("Id cannot be null"));
		}
		// Verify the Player Statistic Player Id is positive
		if($newPlayerStatisticPlayerId <= 0) {
			throw(new \RangeException("Player Statistic Player Id is not positive"));
		}
		// Convert and store the Player Statistic Player Id
		$this->playerStatisticPlayerId = $newPlayerStatisticPlayerId;
	}

	/**
	 *accessor method for Player Statistic Team Id
	 *
	 * @return int|null value of Player Statistic Team Id
	 **/
	public function getPlayerStatisticTeamId() {
		return ($this->playerStatisticTeamId);
	}

	/**
	 * mutator method for Player Statistic Team Id
	 *
	 * @param int|null $newPlayerStatisticTeamId new value of Player Statistic Team Id
	 * @throws \RangeException if the $newPlayerStatisticTeamId is not positive
	 * @throws \TypeError if $newPlayerStatisticTeamId is not an integer
	 **/
	public function setPlayerStatisticTeamId(int $newPlayerStatisticTeamId = null) {
		// base case: if PlayerStatisticTeamId is null, this is a new player statistic team id without a MySQL assigned id (yet)
		if($newPlayerStatisticTeamId === null) {
			throw(new \InvalidArgumentException("Id cannot be null"));
		}
		// Verify the Player Statistic Team Id is positive
		if($newPlayerStatisticTeamId <= 0) {
			throw(new \RangeException("Player Statistic Team Id is not positive"));
		}
		// Convert and store the Player Statistic Player Id
		$this->playerStatisticTeamId = $newPlayerStatisticTeamId;
	}

	/**
	 * accessor method for Player Statistic Statistic Id
	 *
	 * @return int|null value of Player Statistic Statistic Id
	 **/
	public function getPlayerStatisticStatisticId() {
		return ($this->playerStatisticStatisticId);
	}

	/**
	 * mutator method for Player Statistic Statistic Id
	 *
	 * @param int|null $newPlayerStatisticStatisticId new value of Player Statistic Statistic Id
	 * @throws \InvalidArgumentException if $newPlayerStatisticStatisticId is not a string or insecure
	 * @throws \RangeException if $newPlayerStatisticStatisticId is >32 characters
	 * @throws \TypeError if $newPlayerStatisticStatisticId is not an integer
	 **/
	public function setPlayerStatisticStatisticId(int $newPlayerStatisticStatisticId = null) {
		// base case: if PlayerStatisticStatisticId is null, this is a new player statistic Statistic id without a MySQL assigned id (yet)
		if($newPlayerStatisticStatisticId === null) {
			throw(new \InvalidArgumentException("Id cannot be null"));
		}
		// Verify the Player Statistic Statistic Id is positive
		if($newPlayerStatisticStatisticId <= 0) {
			throw(new \RangeException("Player Statistic Player Id is not positive"));
		}
		// Convert and store the Player Statistic Player Id
		$this->playerStatisticStatisticId = $newPlayerStatisticStatisticId;
	}

	/**
	 * accessor method for Player Statistic Value
	 *
	 * @return int value of Player Statistic Value
	 **/

	public function getPlayerStatisticValue() {
		return ($this->playerStatisticValue);
	}

	/**
	 * mutator method for Player Statistic Value
	 *
	 * @param string $newPlayerStatisticValue value of statistic
	 * @throws \InvalidArgumentException if $newPlayerStatisticValue is not an integer or insecure
	 * @throws \RangeException if $newPlayerStatisticValue is >32 characters
	 * @throws \TypeError if $newPlayerStatisticValue is not an integer
	 **/

	public function setPlayerStatisticValue(string $newPlayerStatisticValue) {
		if($newPlayerStatisticValue === null) {
			throw(new \InvalidArgumentException("Player Statistic Value cannot be null"));
		}
		// Convert and store the Player Statistic Player Id
		$this->playerStatisticValue = $newPlayerStatisticValue;
	}

	/**
	 * Inserts this player statistics into mySQL
	 *
	 * @param \PDO $pdo PDO connection object
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError if $pdo is not a PDO connection object
	 **/

	public function insert(\PDO $pdo) {
		// enforce the player statistic game id, the player statistic player id, and the player statistic statistic id exist
		if($this->playerStatisticGameId === null || $this->playerStatisticPlayerId === null || $this->playerStatisticTeamId === null || $this->playerStatisticStatisticId === null) {
			throw(new \PDOException("Ids do not exist"));
		}
		// Create query template
		$query = "INSERT INTO playerStatistic(playerStatisticGameId, playerStatisticPlayerId,playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue) VALUES(:playerStatisticGameId, :playerStatisticPlayerId,:playerStatisticTeamId, :playerStatisticStatisticId, :playerStatisticValue)";
		$statement = $pdo->prepare($query);

		// Bind the member variables to the place holders in template
		$parameters = ["playerStatisticGameId" => $this->playerStatisticGameId, "playerStatisticPlayerId" => $this->playerStatisticPlayerId, "playerStatisticTeamId" => $this->playerStatisticTeamId, "playerStatisticStatisticId" => $this->playerStatisticStatisticId, "playerStatisticValue" => $this->playerStatisticValue];
		$statement->execute($parameters);
	}

	/**
	 * Deletes this statistics from mySQL
	 *
	 * @param \PDO $pdo PDO connection object
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError if $pdo is not a PDO connection object
	 **/

	public function delete(\PDO $pdo) {
		//enforce the Ids are not null
		if($this->playerStatisticGameId === null || $this->playerStatisticPlayerId === null || $this->playerStatisticTeamId === null || $this->playerStatisticStatisticId === null) {
			throw(new \PDOException("Ids do not exist to delete"));
		}
		// Create query template
		$query = "DELETE FROM playerStatistic WHERE playerStatisticGameId | playerStatisticPlayerId | playerStatisticTeamId| playerStatisticStatisticId | playerStatisticValue = playerStatisticGameId | playerStatisticPlayerId | playerStatisticTeamId| playerStatisticStatisticId | playerStatisticValue";
		$statement = $pdo->prepare($query);

		// Bind the member variables to the place holders in template
		$parameters = ["playerStatisticGameId" => $this->playerStatisticGameId, "playerStatisticPlayerId" => $this->playerStatisticPlayerId, "playerStatisticTeamId" => $this->playerStatisticTeamId, "playerStatisticStatisticId" => $this->playerStatisticStatisticId, "playerStatisticValue" => $this->playerStatisticValue];
		$statement->execute($parameters);
	}

	/**
	 * updates this Player Statistics in mySQL
	 *
	 * @param \PDO $pdo PDO connection object
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError if $pdo is not a PDO connection object
	 **/

	public function update(\PDO $pdo) {
		//enforce the Ids are not null
		if($this->playerStatisticGameId === null || $this->playerStatisticPlayerId === null || $this->playerStatisticTeamId === null || $this->playerStatisticStatisticId === null) {
			throw(new \PDOException("Ids do not exist to update"));
		}
		// Create query template
		$query = "UPDATE playerStatistic SET playerStatisticGameId = :playerStatisticGameId, playerStatisticPlayerId = :playerStatisticPlayerId,playerStatisticTeamId = :playerStatisticTeamId, playerStatisticStatisticId = :playerStatisticStatisticId, playerStatisticValue = :playerStatisticValue";
		$statement = $pdo->prepare($query);

		// Bind the member variables to the place holders in template
		$parameters = ["playerStatisticGameId" => $this->playerStatisticGameId, "playerStatisticPlayerId" => $this->playerStatisticPlayerId, "playerStatisticTeamId" => $this->playerStatisticTeamId, "playerStatisticStatisticId" => $this->playerStatisticStatisticId, "playerStatisticValue" => $this->playerStatisticValue];
		$statement->execute($parameters);
	}

	/**
	 * gets the PlayerStatistic by playerStatisticGameId, playerStatisticPlayerId and PlayerStatisticStatisticId
	 *
	 * @param \PDO $pdo PDO connection object
	 * @param int $playerStatisticGameId player statistic game id to search for
	 * @param int $playerStatisticPlayerId player statistic game id to search for
	 * @param int $playerStatisticTeamId player statistic game id to search for
	 * @param int $playerStatisticStatisticId player statistic game id to search for
	 * @return \SplFixedArray SplFixedArray of player statistic game ids found
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError when variables are not the correct data type
	 **/

	public static function getPlayerStatisticByPlayerStatisticGameIdAndPlayerStatisticPlayerIdAndPlayerStatisticTeamIdAndPlayerStatisticStatisticId(\PDO $pdo, int $playerStatisticGameId, int $playerStatisticPlayerId, int $playerStatisticTeamId, int $playerStatisticStatisticId) {
		// sanitize the player statistic statistic id before searching
		if($playerStatisticGameId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticPlayerId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticTeamId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticStatisticId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		// create query template
		$query = "SELECT playerStatisticGameId, playerStatisticPlayerId, playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue FROM playerStatistic WHERE playerStatisticGameId = :playerStatisticGameId AND playerStatisticPlayerID = :playerStatisticPlayerId AND playerStatisticTeamId = :playerStatisticTeamId AND playerStatisticStatisticId = :playerStatisticStatisticId";
		$statement = $pdo->prepare($query);

//Search based on Game, player, team, statistic ids
		$parameters = ["playerStatisticGameId" => $playerStatisticGameId, "playerStatisticPlayerId" => $playerStatisticPlayerId, "playerStatisticTeamId" => $playerStatisticTeamId, "playerStatisticStatisticId" => $playerStatisticStatisticId];
		$statement->execute($parameters);

		//Grab the them from mySQL
		try {
			$playerStatistic = null;
			$statement->setFetchMode(\PDO::FETCH_ASSOC);
			$row = $statement->fetch();
			if($row !== false) {
				$playerStatistic = new PlayerStatistic($row["playerStatisticGameId"], $row["playerStatisticPlayerId"], $row["playerStatisticTeamId"], $row["playerStatisticStatisticId"], $row["playerStatisticValue"]);
			}
		} catch(\Exception $exception) {
			//If the row couldn't be converted, rethrow it
			throw(new \PDOException($exception->getMessage(), 0, $exception));
		}
		return ($playerStatistic);
	}

	/**
	 * gets the TeamStatistic by playerStatisticGameId
	 *
	 * @param \PDO $pdo PDO connection object
	 * @param int $playerStatisticGameId player statistic game id to search for
	 * @param int $playerStatisticPlayerId player statistic game id to search for
	 * @param int $playerStatisticTeamId player statistic game id to search for
	 * @param int $playerStatisticStatisticId player statistic game id to search for
	 * @return \SplFixedArray SplFixedArray of player statistic game ids found
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError when variables are not the correct data type
	 **/

	public static function getPlayerStatisticByPlayerStatisticGameId(\PDO $pdo, int $playerStatisticGameId, int $playerStatisticPlayerId, int $playerStatisticTeamId, int $playerStatisticStatisticId) {
		// sanitize the player statistic statistic id before searching
		if($playerStatisticGameId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticPlayerId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticTeamId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticStatisticId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		// create query template
		$query = "SELECT playerStatisticGameId, playerStatisticPlayerId, playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue FROM playerStatistic WHERE playerStatisticGameId = :playerStatisticGameId  AND playerStatisticPlayerID = :playerStatisticPlayerId AND playerStatisticTeamId = :playerStatisticTeamId AND playerStatisticStatisticId = :playerStatisticStatisticId";
		$statement = $pdo->prepare($query);

		//Search based on Game, player, team, statistic ids
		$parameters = ["playerStatisticGameId" => $playerStatisticGameId, "playerStatisticPlayerId" => $playerStatisticPlayerId, "playerStatisticTeamId" => $playerStatisticTeamId, "playerStatisticStatisticId" => $playerStatisticStatisticId];
		$statement->execute($parameters);

		//Grab the them from mySQL
		try {
			$playerStatistic = null;
			$statement->setFetchMode(\PDO::FETCH_ASSOC);
			$row = $statement->fetch();
			if($row !== false) {
				$playerStatistic = new PlayerStatistic($row["playerStatisticGameId"], $row["playerStatisticPlayerId"], $row["playerStatisticTeamId"], $row["playerStatisticStatisticId"], $row["playerStatisticValue"]);
			}
		} catch(\Exception $exception) {
			//If the row couldn't be converted, rethrow it
			throw(new \PDOException($exception->getMessage(), 0, $exception));
		}
		return ($playerStatistic);
	}

	/**
	 * gets the TeamStatistic by playerStatisticPlayerId
	 *
	 * @param \PDO $pdo PDO connection object
	 * @param int $playerStatisticGameId player statistic game id to search for
	 * @param int $playerStatisticPlayerId player statistic game id to search for
	 * @param int $playerStatisticTeamId player statistic game id to search for
	 * @param int $playerStatisticStatisticId player statistic game id to search for
	 * @return \SplFixedArray SplFixedArray of player statistic game ids found
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError when variables are not the correct data type
	 **/

	public static function getPlayerStatisticByPlayerStatisticPlayerId(\PDO $pdo, int $playerStatisticPlayerId) {
		// sanitize the player statistic statistic id before searching
		if($playerStatisticPlayerId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		// create query template
		$query = "SELECT playerStatisticGameId, playerStatisticPlayerId, playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue FROM playerStatistic WHERE playerStatisticPlayerId = :playerStatisticPlayerId";
		$statement = $pdo->prepare($query);

		//Search based on Game, player, team, statistic ids
		$parameters = ["playerStatisticPlayerId" => $playerStatisticPlayerId];
		$statement->execute($parameters);

		// build an array of Player Statistics
		$playerStatistics = new \SplFixedArray($statement->rowCount());
		$statement->setFetchMode(\PDO::FETCH_ASSOC);
		while(($row = $statement->fetch()) !== false) {
			try {
				$playerStatistic = new PlayerStatistic($row["playerStatisticGameId"], $row["playerStatisticPlayerId"], $row["playerStatisticTeamId"], $row["playerStatisticStatisticId"], $row["playerStatisticValue"]);
				$playerStatistics[$playerStatistics->key()] = $playerStatistic;
				$playerStatistics->next();
			} Catch(\Exception $exception) {
				// if the row couldn't be converted, rethrow it
				throw(new \PDOException($exception->getMessage(), 0, $exception));
			}
		}
		return ($playerStatistics);
	}

	/**
	 * gets the TeamStatistic by playerStatisticTeamId
	 *
	 * @param \PDO $pdo PDO connection object
	 * @param int $playerStatisticGameId player statistic game id to search for
	 * @param int $playerStatisticPlayerId player statistic game id to search for
	 * @param int $playerStatisticTeamId player statistic game id to search for
	 * @param int $playerStatisticStatisticId player statistic game id to search for
	 * @return \SplFixedArray SplFixedArray of player statistic game ids found
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError when variables are not the correct data type
	 **/

	public static function getPlayerStatisticByPlayerStatisticTeamId(\PDO $pdo, int $playerStatisticGameId, int $playerStatisticPlayerId, int $playerStatisticTeamId, int $playerStatisticStatisticId) {
		// sanitize the player statistic statistic id before searching
		if($playerStatisticGameId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticPlayerId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticTeamId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticStatisticId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}
		// create query template
		$query = "SELECT playerStatisticGameId, playerStatisticPlayerId, playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue FROM playerStatistic WHERE playerStatisticGameId = :playerStatisticGameId  AND playerStatisticPlayerID = :playerStatisticPlayerId AND playerStatisticTeamId = :playerStatisticTeamId AND playerStatisticStatisticId = :playerStatisticStatisticId";
		$statement = $pdo->prepare($query);

		//Search based on Game, player, team, statistic ids
		$parameters = ["playerStatisticGameId" => $playerStatisticGameId, "playerStatisticPlayerId" => $playerStatisticPlayerId, "playerStatisticTeamId" => $playerStatisticTeamId, "playerStatisticStatisticId" => $playerStatisticStatisticId];
		$statement->execute($parameters);

		//Grab the them from mySQL
		try {
			$playerStatistic = null;
			$statement->setFetchMode(\PDO::FETCH_ASSOC);
			$row = $statement->fetch();
			if($row !== false) {
				$playerStatistic = new PlayerStatistic($row["playerStatisticGameId"], $row["playerStatisticPlayerId"], $row["playerStatisticTeamId"], $row["playerStatisticStatisticId"], $row["playerStatisticValue"]);
			}
		} catch(\Exception $exception) {
			//If the row couldn't be converted, rethrow it
			throw(new \PDOException($exception->getMessage(), 0, $exception));
		}
		return ($playerStatistic);
	}

	/**
	 * gets the PlayerStatistic by playerStatisticStatisticId
	 *
	 * @param \PDO $pdo PDO connection object
	 * @param int $playerStatisticGameId player statistic game id to search for
	 * @param int $playerStatisticPlayerId player statistic game id to search for
	 * @param int $playerStatisticTeamId player statistic game id to search for
	 * @param int $playerStatisticStatisticId player statistic game id to search for
	 * @return \SplFixedArray SplFixedArray of player statistic game ids found
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError when variables are not the correct data type
	 **/
	public static function getPlayerStatisticByPlayerStatisticStatisticId(\PDO $pdo, int $playerStatisticGameId, int $playerStatisticPlayerId, int $playerStatisticTeamId, int $playerStatisticStatisticId) {
		// sanitize the player statistic statistic id before searching
		if($playerStatisticGameId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticPlayerId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticTeamId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}

		if($playerStatisticStatisticId <= 0) {
			throw (new \PDOException("player statistic game id is not positive"));
		}
		// create query template
		$query = "SELECT playerStatisticGameId, playerStatisticPlayerId, playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue FROM playerStatistic WHERE playerStatisticGameId = :playerStatisticGameId  AND playerStatisticPlayerID = :playerStatisticPlayerId AND playerStatisticTeamId = :playerStatisticTeamId AND playerStatisticStatisticId = :playerStatisticStatisticId";
		$statement = $pdo->prepare($query);

		//Search based on Game, player, team, statistic ids
		$parameters = ["playerStatisticGameId" => $playerStatisticGameId, "playerStatisticPlayerId" => $playerStatisticPlayerId, "playerStatisticTeamId" => $playerStatisticTeamId, "playerStatisticStatisticId" => $playerStatisticStatisticId];
		$statement->execute($parameters);

		//Grab the them from mySQL
		try {
			$playerStatistic = null;
			$statement->setFetchMode(\PDO::FETCH_ASSOC);
			$row = $statement->fetch();
			if($row !== false) {
				$playerStatistic = new PlayerStatistic($row["playerStatisticGameId"], $row["playerStatisticPlayerId"], $row["playerStatisticTeamId"], $row["playerStatisticStatisticId"], $row["playerStatisticValue"]);
			}
		} catch(\Exception $exception) {
			//If the row couldn't be converted, rethrow it
			throw(new \PDOException($exception->getMessage(), 0, $exception));
		}
		return ($playerStatistic);
	}

	/**
	 * gets all PlayerStatistics
	 *
	 * @param \PDO $pdo PDO connection object
	 * @return \SplFixedArray SplFixedArray of PlayerStatistics found or null if not found
	 * @throws \PDOException when mySQL related errors occur
	 * @throws \TypeError when variables are not the correct data type
	 **/

	public static function getAllPlayerStatistics(\PDO $pdo) {
		//create query template
		$query = "SELECT playerStatisticGameId, playerStatisticPlayerId, playerStatisticTeamId, playerStatisticStatisticId, playerStatisticValue FROM playerStatistic";
		$statement = $pdo->prepare($query);
		$statement->execute();

		// build an array of Player Statistics
		$playerStatistics = new \SplFixedArray($statement->rowCount());
		$statement->setFetchMode(\PDO::FETCH_ASSOC);
		while(($row = $statement->fetch()) !== false) {
			try {
				$playerStatistic = new PlayerStatistic($row["playerStatisticGameId"], $row["playerStatisticPlayerId"], $row["playerStatisticTeamId"], $row["playerStatisticStatisticId"], $row["playerStatisticValue"]);
				$playerStatistics[$playerStatistics->key()] = $playerStatistic;
				$playerStatistics->next();
			} Catch(\Exception $exception) {
				// if the row couldn't be converted, rethrow it
				throw(new \PDOException($exception->getMessage(), 0, $exception));
			}
		}
		return ($playerStatistics);
	}

	public function jsonSerialize() {
		return(get_object_vars($this));
	}
}


text:
package com.lightbend.lagom.scaladsl.testkit

import com.lightbend.lagom.scaladsl.api.broker.Topic
import com.lightbend.lagom.scaladsl.server.LagomApplicationContext
import com.lightbend.lagom.scaladsl.server.LocalServiceLocator
import com.lightbend.lagom.scaladsl.testkit.services._
import org.scalatest.concurrent.Eventually
import org.scalatest.time.Seconds
import org.scalatest.time.Span
import org.scalatest.AsyncWordSpec
import org.scalatest.BeforeAndAfterAll
import org.scalatest.Matchers

class ProducerStubSpec extends AsyncWordSpec with Matchers with BeforeAndAfterAll with Eventually {

  var producerStub: ProducerStub[AlphaEvent] = _

  private val stubbedApplication: LagomApplicationContext => DownstreamApplication = { ctx =>
    new DownstreamApplication(ctx) with LocalServiceLocator with TestTopicComponents {
      val stubFactory = new ProducerStubFactory(actorSystem, materializer)
      producerStub = stubFactory.producer[AlphaEvent](AlphaService.TOPIC_ID)
      override lazy val alphaService = new AlphaServiceStub(producerStub)
    }
  }

  "The ProducerStub" should {
    "send message to consuming services" in ServiceTest.withServer(ServiceTest.defaultSetup.withCluster())(
      stubbedApplication
    ) { server =>
      implicit val exCtx = server.application.actorSystem.dispatcher
      producerStub.send(AlphaEvent(22))
      eventually(timeout(Span(5, Seconds))) {
        server.serviceClient
          .implement[CharlieService]
          .messages
          .invoke()
          .map { response =>
            response should ===(Seq(ReceivedMessage("A", 22)))
          }
          .recover {
            case t: Throwable => fail(t)
          }
      }
    }
  }

}

class AlphaServiceStub(stub: ProducerStub[AlphaEvent]) extends AlphaService {
  override def messages: Topic[AlphaEvent] = stub.topic

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<name>AKTIN : Broker : local authentication plugin</name>
	<packaging>jar</packaging>

	<description>
	 Authentication module using local authentication and authorization.
	 This module is meant for the broker-server.
	</description>

	<artifactId>broker-auth-local</artifactId>

	<parent>
		<groupId>org.aktin</groupId>
		<artifactId>broker</artifactId>
		<version>1.3.5-SNAPSHOT</version>
	</parent>

	<dependencies>

		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>javax.ws.rs-api</artifactId>
			<version>2.0.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.annotation</groupId>
			<artifactId>javax.annotation-api</artifactId>
			<version>1.2</version>
			<scope>provided</scope>
		</dependency>
		<!-- broker API -->
		<dependency>
			<groupId>org.aktin</groupId>
			<artifactId>broker-api</artifactId>
			<version>1.3.5-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>org.aktin</groupId>
			<artifactId>broker-server</artifactId>
			<version>1.3.5-SNAPSHOT</version>
		</dependency>

		<!--
		<dependency>
			<groupId>jakarta.xml.bind</groupId>
			<artifactId>jakarta.xml.bind-api</artifactId>
			<version>2.3.3</version>
		</dependency>
		-->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>
</project>


text:
layout: organization
category: local

title: Project Hospitality Hurricane Sandy Relief
impact_area: Disaster Relief
keywords:
location_services:
location_offices:
website: projecthospitality.org

description:
mission: |
  It is the mission of Project Hospitality, Inc. to reach out to community members who are hungry, homeless or otherwise in need in order to work with them to achieve their self-sufficiency — thereby enhancing the quality of life for our community.

cash_grants:
grants:
service_opp:
services:

learn:
cont_relationship:

salutation:
first_name:
last_name:
title_contact_person:

city: Staten Island
state: NY
address: |
  950 West Fingerboard Road
  Staten Island NY 10305
lat: 40.601253
lng: -74.086552
phone:
ext:
fax:
email:
preferred_contact:
contact_person_intro:
---


text:
var brightpearlOrderUrl = ["https://use1.brightpearlapp.com/patt-op.php?scode=invoice*"];
chrome.contextMenus.create({
	"title" : "Copy From Brightpearl Order",
	"type" : "normal",
	"documentUrlPatterns":brightpearlOrderUrl,
	"onclick": copyBrightpearlOrder
});

var tollUrl = ["https://online.toll.com.au/trackandtrace/newConnoteEntry.do"];
chrome.contextMenus.create({
	"title" : "Paste To Toll",
	"type" : "normal",
	"documentUrlPatterns":tollUrl,
	"onclick":pasteToll
});

var brightpearlExistingCustomerUrl = ["https://use1.brightpearlapp.com/patt-op.php?scode=contact&cID=*"];
chrome.contextMenus.create({
	"title" : "Copy From Brightpearl Customer",
	"type" : "normal",
	"documentUrlPatterns":brightpearlExistingCustomerUrl,
	"onclick": copyBrightpearlCustomer
});

var brightpearlNewCustomerUrl = ["https://use1.brightpearlapp.com/patt-op.php?scode=contact&type=customer"];
chrome.contextMenus.create({
	"title" : "Paste Brightpearl Customer",
	"type" : "normal",
	"documentUrlPatterns":brightpearlNewCustomerUrl,
	"onclick": pasteBrightpearlCustomer
});

var brightpearlCustomerUrl = ["https://use1.brightpearlapp.com/patt-op.php?scode=contact*"];
chrome.contextMenus.create({
	"title" : "Search Address 1 in Google Maps",
	"type" : "normal",
	"documentUrlPatterns":brightpearlCustomerUrl,
	"onclick": searchBrightpearlAddress
});

function copyBrightpearlOrder(){
	chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
		chrome.tabs.sendMessage( tabs[0].id, {method: "copyBrightpearlOrder"},function(response){
			localStorage.setItem('CustomerFields',response.data);
		});
});
}

function pasteToll(){
	var customerData = localStorage.getItem('CustomerFields');
	chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
		chrome.tabs.sendMessage( tabs[0].id, {method: "pasteToll",data:customerData},function(response){

		});
	});

}

function copyBrightpearlCustomer(){
	chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
		chrome.tabs.sendMessage( tabs[0].id, {method: "copyBrightpearlCustomer"},function(response){
			localStorage.setItem('CustomerFieldsCustomer',response.data);
		});
});
}

function pasteBrightpearlCustomer(){
	var customerData = localStorage.getItem('CustomerFieldsCustomer');
	chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
		chrome.tabs.sendMessage( tabs[0].id, {method: "pasteBrightpearlCustomer",data:customerData},function(response){

		});
	});
}

function searchBrightpearlAddress(){

	chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
		chrome.tabs.sendMessage( tabs[0].id, {method: "findAddressInGoogle"},function(response){
		});
	});
}


text:
package com.bumptech.glide.load.engine.bitmap_recycle;

import static android.content.ComponentCallbacks2.TRIM_MEMORY_BACKGROUND;
import static android.content.ComponentCallbacks2.TRIM_MEMORY_COMPLETE;
import static android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import android.annotation.TargetApi;
import android.os.Build;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 18)
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class LruArrayPoolTest {
  private static final int MAX_SIZE = 10;
  private static final int MAX_PUT_SIZE = MAX_SIZE / 2;
  private static final Class<byte[]> ARRAY_CLASS = byte[].class;
  private static final ArrayAdapterInterface<byte[]> ADAPTER = new ByteArrayAdapter();
  private LruArrayPool pool;

  @Before
  public void setUp() throws Exception {
    pool = new LruArrayPool(MAX_SIZE);
  }

  @Test
  public void testNewPoolIsEmpty() {
    assertEquals(pool.getCurrentSize(), 0);
  }

  @Test
  public void testICanAddAndGetValidArray() {
    int size = 758;
    int value = 564;
    fillPool(pool, size - 1, value);
    pool.put(createArray(ARRAY_CLASS, size, value));
    Object array = pool.get(size, ARRAY_CLASS);
    assertNotNull(array);
    assertTrue(array.getClass() == ARRAY_CLASS);
    assertTrue(ADAPTER.getArrayLength((byte[]) array) >= size);
    assertTrue(((byte[]) array)[0] == (byte) 0);
  }

  @Test
  public void testItIsSizeLimited() {
    fillPool(pool, MAX_SIZE / ADAPTER.getElementSizeInBytes() + 1, 1);
    assertTrue(pool.getCurrentSize() <= MAX_SIZE);
  }

  @Test
  public void testArrayLargerThanPoolIsNotAdded() {
    pool = new LruArrayPool(MAX_SIZE);
    pool.put(createArray(ARRAY_CLASS, MAX_SIZE / ADAPTER.getElementSizeInBytes() + 1, 0));
    assertEquals(0, pool.getCurrentSize());
  }

  @Test
  public void testClearMemoryRemovesAllArrays() {
    fillPool(pool, MAX_SIZE / ADAPTER.getElementSizeInBytes() + 1, 0);
    pool.clearMemory();
    assertEquals(0, pool.getCurrentSize());
  }

  @Test
  public void testTrimMemoryUiHiddenOrLessRemovesHalfOfArrays() {
    testTrimMemory(MAX_SIZE, TRIM_MEMORY_UI_HIDDEN, MAX_SIZE / 2);
  }

  @Test
  public void testTrimMemoryUiHiddenOrLessRemovesNoArraysIfPoolLessThanHalfFull() {
    testTrimMemory(MAX_SIZE / 2, TRIM_MEMORY_UI_HIDDEN, MAX_SIZE / 2);
  }

  @Test
  public void testTrimMemoryBackgroundOrGreaterRemovesAllArrays() {
    for (int trimLevel : new int[] {TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE}) {
      testTrimMemory(MAX_SIZE, trimLevel, 0);
    }
  }

  @Test
  public void get_withEmptyPool_returnsExactArray() {
    assertThat(pool.get(MAX_PUT_SIZE, byte[].class)).hasLength(MAX_PUT_SIZE);
  }

  @Test
  public void get_withPoolContainingLargerArray_returnsLargerArray() {
    byte[] expected = new byte[MAX_PUT_SIZE];
    pool.put(expected);
    assertThat(pool.get(MAX_PUT_SIZE - 1, byte[].class)).isSameAs(expected);
  }

  @Test
  public void get_withPoolContainingSmallerArray_returnsExactArray() {
    pool.put(new byte[MAX_PUT_SIZE - 1]);
    assertThat(pool.get(MAX_PUT_SIZE, byte[].class)).hasLength(MAX_PUT_SIZE);
  }

  @Test
  public void get_withPoolLessThanHalfFull_returnsFromPools() {
    int size = MAX_SIZE / 2;
    byte[] expected = new byte[size];
    pool.put(expected);
    assertThat(pool.get(1, byte[].class)).isSameAs(expected);
  }

  @Test
  public void get_withPoolMoreThanHalfFull_sizeMoreThanHalfArrayInPool_returnsArray() {
    Set<byte[]> expected = new HashSet<>();
    for (int i = 0; i < 3; i++) {
      byte[] toPut = new byte[MAX_SIZE / 3];
      expected.add(toPut);
      pool.put(toPut);
    }
    byte[] received = pool.get(2, byte[].class);
    assertThat(expected).contains(received);
  }

  @Test
  public void get_withPoolMoreThanHalfFull_sizeLessThanHalfArrayInPool_returnsNewArray() {
    pool = new LruArrayPool(100);
    for (int i = 0; i < 3; i++) {
      byte[] toPut = new byte[100 / 3];
      pool.put(toPut);
    }
    int requestedSize = 100 / 3 / LruArrayPool.MAX_OVER_SIZE_MULTIPLE;
    byte[] received = pool.get(requestedSize, byte[].class);
    assertThat(received).hasLength(requestedSize);
  }

  @Test
  public void getExact_withEmptyPool_returnsExactArray() {
    byte[] result = pool.getExact(MAX_PUT_SIZE, byte[].class);
    assertThat(result).hasLength(MAX_PUT_SIZE);
  }

  @Test
  public void getExact_withPoolContainingLargerArray_returnsExactArray() {
    pool.put(new byte[MAX_PUT_SIZE]);
    int expectedSize = MAX_PUT_SIZE - 1;
    assertThat(pool.getExact(expectedSize, byte[].class)).hasLength(expectedSize);
  }

  @Test
  public void getExact_withPoolContainingSmallerArray_returnsExactArray() {
    pool.put(new byte[MAX_PUT_SIZE - 1]);
    assertThat(pool.getExact(MAX_PUT_SIZE, byte[].class)).hasLength(MAX_PUT_SIZE);
  }

  @Test
  public void getExact_withPoolContainingExactArray_returnsArray() {
    byte[] expected = new byte[MAX_PUT_SIZE];
    pool.put(expected);
    assertThat(pool.getExact(MAX_PUT_SIZE, byte[].class)).isSameAs(expected);
  }

  @Test
  public void put_withArrayMoreThanHalfPoolSize_doesNotRetainArray() {
    int targetSize = (MAX_SIZE / 2) + 1;
    byte[] toPut = new byte[targetSize];
    pool.put(toPut);
    assertThat(pool.getCurrentSize()).isEqualTo(0);
    assertThat(pool.get(targetSize, byte[].class)).isNotSameAs(toPut);
  }

  private void testTrimMemory(int fillSize, int trimLevel, int expectedSize) {
    pool = new LruArrayPool(MAX_SIZE);
    fillPool(pool, fillSize / ADAPTER.getElementSizeInBytes(), 1);
    pool.trimMemory(trimLevel);
    assertEquals("Failed level=" + trimLevel, expectedSize, pool.getCurrentSize());
  }

  private void fillPool(LruArrayPool pool, int arrayCount, int arrayLength) {
    for (int i = 0; i < arrayCount; i++) {
      pool.put(createArray(ARRAY_CLASS, arrayLength, 10));
    }
  }

  @SuppressWarnings("unchecked")
  private static <T> T createArray(Class<T> type, int size, int value) {
    Object array = null;
    if (type.equals(int[].class)) {
      array = new int[size];
      Arrays.fill((int[]) array, value);
    } else if (type.equals(byte[].class)) {
      array = new byte[size];
      Arrays.fill((byte[]) array, (byte) value);
    }
    return (T) array;
  }
}