Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions
LICENSE
assets
css
fonts
img
badge.pngbg-setup.png
checkout-forms
empty-state-bg.pngerasmo-carlos.jpg
flags
1x1
ad.svgae.svgaf.svgag.svgai.svgal.svgam.svgao.svgaq.svgar.svgas.svgat.svgau.svgaw.svgax.svgaz.svgba.svgbb.svgbd.svgbe.svgbf.svgbg.svgbh.svgbi.svgbj.svgbl.svgbm.svgbn.svgbo.svgbq.svgbr.svgbs.svgbt.svgbv.svgbw.svgby.svgbz.svgca.svgcc.svgcd.svgcf.svgcg.svgch.svgci.svgck.svgcl.svgcm.svgcn.svgco.svgcr.svgcu.svgcv.svgcw.svgcx.svgcy.svgcz.svgde.svgdj.svgdk.svgdm.svgdo.svgdz.svgec.svgee.svgeg.svgeh.svger.svges-ca.svges-ga.svges.svget.svgeu.svgfi.svgfj.svgfk.svgfm.svgfo.svgfr.svgga.svggb-eng.svggb-nir.svggb-sct.svggb-wls.svggb.svggd.svgge.svggf.svggg.svggh.svggi.svggl.svggm.svggn.svggp.svggq.svggr.svggs.svggt.svggu.svggw.svggy.svghk.svghm.svghn.svghr.svght.svghu.svgid.svgie.svgil.svgim.svgin.svgio.svgiq.svgir.svgis.svgit.svgje.svgjm.svgjo.svgjp.svgke.svgkg.svgkh.svgki.svgkm.svgkn.svgkp.svgkr.svgkw.svgky.svgkz.svgla.svglb.svglc.svgli.svglk.svglr.svgls.svglt.svglu.svglv.svgly.svgma.svgmc.svgmd.svgme.svgmf.svgmg.svgmh.svgmk.svgml.svgmm.svgmn.svgmo.svgmp.svgmq.svgmr.svgms.svgmt.svgmu.svgmv.svgmw.svgmx.svgmy.svgmz.svgna.svgnc.svgne.svgnf.svgng.svgni.svgnl.svgno.svgnp.svgnr.svgnu.svgnz.svgom.svgpa.svgpe.svgpf.svgpg.svgph.svgpk.svgpl.svgpm.svgpn.svgpr.svgps.svgpt.svgpw.svgpy.svgqa.svgre.svgro.svgrs.svgru.svgrw.svgsa.svgsb.svgsc.svgsd.svgse.svgsg.svgsh.svgsi.svgsj.svgsk.svgsl.svgsm.svgsn.svgso.svgsr.svgss.svgst.svgsv.svgsx.svgsy.svgsz.svgtc.svgtd.svgtf.svgtg.svgth.svgtj.svgtk.svgtl.svgtm.svgtn.svgto.svgtr.svgtt.svgtv.svgtw.svgtz.svgua.svgug.svgum.svgun.svgus.svguy.svguz.svgva.svgvc.svgve.svgvg.svgvi.svgvn.svgvu.svgwf.svgws.svgxk.svgye.svgyt.svgza.svgzm.svgzw.svg
4x3
ad.svgae.svgaf.svgag.svgai.svgal.svgam.svgao.svgaq.svgar.svgas.svgat.svgau.svgaw.svgax.svgaz.svgba.svgbb.svgbd.svgbe.svgbf.svgbg.svgbh.svgbi.svgbj.svgbl.svgbm.svgbn.svgbo.svgbq.svgbr.svgbs.svgbt.svgbv.svgbw.svgby.svgbz.svgca.svgcc.svgcd.svgcf.svgcg.svgch.svgci.svgck.svgcl.svgcm.svgcn.svgco.svgcr.svgcu.svgcv.svgcw.svgcx.svgcy.svgcz.svgde.svgdj.svgdk.svgdm.svgdo.svgdz.svgec.svgee.svgeg.svgeh.svger.svges-ca.svges-ga.svges.svget.svgeu.svgfi.svgfj.svgfk.svgfm.svgfo.svgfr.svgga.svggb-eng.svggb-nir.svggb-sct.svggb-wls.svggb.svggd.svgge.svggf.svggg.svggh.svggi.svggl.svggm.svggn.svggp.svggq.svggr.svggs.svggt.svggu.svggw.svggy.svghk.svghm.svghn.svghr.svght.svghu.svgid.svgie.svgil.svgim.svgin.svgio.svgiq.svgir.svgis.svgit.svgje.svgjm.svgjo.svgjp.svgke.svgkg.svgkh.svgki.svgkm.svgkn.svgkp.svgkr.svgkw.svgky.svgkz.svgla.svglb.svglc.svgli.svglk.svglr.svgls.svglt.svglu.svglv.svgly.svgma.svgmc.svgmd.svgme.svgmf.svgmg.svgmh.svgmk.svgml.svgmm.svgmn.svgmo.svgmp.svgmq.svgmr.svgms.svgmt.svgmu.svgmv.svgmw.svgmx.svgmy.svgmz.svgna.svgnc.svgne.svgnf.svgng.svgni.svgnl.svgno.svgnp.svgnr.svgnu.svgnz.svgom.svgpa.svgpe.svgpf.svgpg.svgph.svgpk.svgpl.svgpm.svgpn.svgpr.svgps.svgpt.svgpw.svgpy.svgqa.svgre.svgro.svgrs.svgru.svgrw.svgsa.svgsb.svgsc.svgsd.svgse.svgsg.svgsh.svgsi.svgsj.svgsk.svgsl.svgsm.svgsn.svgso.svgsr.svgss.svgst.svgsv.svgsx.svgsy.svgsz.svgtc.svgtd.svgtf.svgtg.svgth.svgtj.svgtk.svgtl.svgtm.svgtn.svgto.svgtr.svgtt.svgtv.svgtw.svgtz.svgua.svgug.svgum.svgun.svgus.svguy.svguz.svgva.svgvc.svgve.svgvg.svgvi.svgvn.svgvu.svgwf.svgws.svgxk.svgye.svgyt.svgza.svgzm.svgzw.svg
hosts
loader.svglogo.pngno-preview.pngpattern-wp-ultimo.png
settings
sidebar
site-placeholder-image.png
wizards
wp-ultimo-screenshot.png
js
addons.jsaddons.min.jsadmin-notices.jsadmin-notices.min.jsadmin-screen.jsadmin-screen.min.jsadmin.jsadmin.min.jsapp.jsapp.min.jscheckout-form-editor-modal.jscheckout-form-editor-modal.min.jscheckout-forms-editor.jscheckout-forms-editor.min.jscheckout.jscheckout.min.jscookie-helpers.jscookie-helpers.min.jscustomizer.jscustomizer.min.jsdashboard-statistics.jsdashboard-statistics.min.jsedit-placeholders.jsedit-placeholders.min.jsemail-edit-page.jsemail-edit-page.min.jsevent-view-page.jsevent-view-page.min.jsfields.jsfields.min.jsfunctions.jsfunctions.min.js
gateways
gutenberg-support.jsgutenberg-support.min.jsjumper.jsjumper.min.jslegacy-signup.jslegacy-signup.min.js
lib
list-tables.jslist-tables.min.jsscreenshot-scraper.jsscreenshot-scraper.min.jsselectizer.jsselectizer.min.jssetup-wizard-polyfill.jssetup-wizard-polyfill.min.jssetup-wizard.jssetup-wizard.min.jssite-maintenance.jssite-maintenance.min.jssso.jssso.min.jssupport.jssupport.min.jstax-rates.jstax-rates.min.jstax-statistics.jstax-statistics.min.jstemplate-previewer.jstemplate-previewer.min.jstemplate-switching.jstemplate-switching.min.jsthank-you.jsthank-you.min.jstours.jstours.min.jsurl-preview.jsurl-preview.min.jsview-logs.jsview-logs.min.jsvisits-counter.jsvisits-counter.min.jsvue-apps.jsvue-apps.min.jswebhook-list-page.jswebhook-list-page.min.jswebhook-page.jswebhook-page.min.jswubox.jswubox.min.js
autoload.phpconstants.php
data
dependencies
amphp
amp
byte-stream
cache
dns
hpack
http-client
http
parser
process
serialization
socket
sync
windows-registry
autoload.php
berlindb
composer
daverandom
delight-im
doctrine
deprecations
lib
Doctrine
guzzlehttp
guzzle
promises
psr7
hashids
ifsnop
mysqldump-php
src
Ifsnop
Mysqldump
jasny
kelunik
league
mexitek
phpcolors
demo
src
Mexitek
PHPColors
mpdf
mpdf
CREDITS.txt
data
CJKdata.php
collations
Afrikaans_South_Africa.phpAlbanian_Albania.phpAlsatian_France.phpArabic_Algeria.phpArabic_Bahrain.phpArabic_Egypt.phpArabic_Iraq.phpArabic_Jordan.phpArabic_Kuwait.phpArabic_Lebanon.phpArabic_Libya.phpArabic_Morocco.phpArabic_Oman.phpArabic_Pseudo_RTL.phpArabic_Qatar.phpArabic_Saudi_Arabia.phpArabic_Syria.phpArabic_Tunisia.phpArabic_Yemen.phpAzeri_(Cyrillic)_Azerbaijan.phpAzeri_(Latin)_Azerbaijan.phpBashkir_Russia.phpBasque_Spain.phpBelarusian_Belarus.phpBosnian_(Cyrillic)_Bosnia_and_Herzegovina.phpBosnian_(Latin)_Bosnia_and_Herzegovina.phpBreton_France.phpBulgarian_Bulgaria.phpCatalan_Spain.phpCorsican_France.phpCroatian_(Latin)_Bosnia_and_Herzegovina.phpCroatian_Croatia.phpCzech_Czech_Republic.phpDanish_Denmark.phpDari_Afghanistan.phpDutch_Belgium.phpDutch_Netherlands.phpEnglish_Australia.phpEnglish_Belize.phpEnglish_Canada.phpEnglish_Caribbean.phpEnglish_India.phpEnglish_Ireland.phpEnglish_Jamaica.phpEnglish_Malaysia.phpEnglish_New_Zealand.phpEnglish_Republic_of_the_Philippines.phpEnglish_Singapore.phpEnglish_South_Africa.phpEnglish_Trinidad_and_Tobago.phpEnglish_United_Kingdom.phpEnglish_United_States.phpEnglish_Zimbabwe.phpEstonian_Estonia.phpFaroese_Faroe_Islands.phpFilipino_Philippines.phpFinnish_Finland.phpFrench_Belgium.phpFrench_Canada.phpFrench_France.phpFrench_Luxembourg.phpFrench_Principality_of_Monaco.phpFrench_Switzerland.phpFrisian_Netherlands.phpGalician_Spain.phpGerman_Austria.phpGerman_Germany.phpGerman_Liechtenstein.phpGerman_Luxembourg.phpGerman_Switzerland.phpGreek_Greece.phpGreenlandic_Greenland.phpHausa_(Latin)_Nigeria.phpHebrew_Israel.phpHungarian_Hungary.phpIcelandic_Iceland.phpIgbo_Nigeria.phpIndonesian_Indonesia.phpInuktitut_(Latin)_Canada.phpInvariant_Language_Invariant_Country.phpIrish_Ireland.phpItalian_Italy.phpItalian_Switzerland.phpKinyarwanda_Rwanda.phpKiswahili_Kenya.phpKyrgyz_Kyrgyzstan.phpLatvian_Latvia.phpLithuanian_Lithuania.phpLower_Sorbian_Germany.phpLuxembourgish_Luxembourg.phpMacedonian_(FYROM)_Macedonia_(FYROM).phpMalay_Brunei_Darussalam.phpMalay_Malaysia.phpMapudungun_Chile.phpMohawk_Canada.phpMongolian_(Cyrillic)_Mongolia.phpNorwegian_(Nynorsk)_Norway.phpOccitan_France.phpPersian_Iran.phpPolish_Poland.phpPortuguese_Brazil.phpPortuguese_Portugal.phpQuechua_Bolivia.phpQuechua_Ecuador.phpQuechua_Peru.phpRomanian_Romania.phpRomansh_Switzerland.phpRussian_Russia.phpSami_(Inari)_Finland.phpSami_(Lule)_Norway.phpSami_(Lule)_Sweden.phpSami_(Northern)_Finland.phpSami_(Northern)_Norway.phpSami_(Northern)_Sweden.phpSami_(Skolt)_Finland.phpSami_(Southern)_Norway.phpSami_(Southern)_Sweden.phpSerbian_(Cyrillic)_Bosnia_and_Herzegovina.phpSerbian_(Cyrillic)_Serbia.phpSerbian_(Latin)_Bosnia_and_Herzegovina.phpSerbian_(Latin)_Serbia.phpSesotho_sa_Leboa_South_Africa.phpSetswana_South_Africa.phpSlovak_Slovakia.phpSlovenian_Slovenia.phpSpanish_Argentina.phpSpanish_Bolivia.phpSpanish_Chile.phpSpanish_Colombia.phpSpanish_Costa_Rica.phpSpanish_Dominican_Republic.phpSpanish_Ecuador.phpSpanish_El_Salvador.phpSpanish_Guatemala.phpSpanish_Honduras.phpSpanish_Mexico.phpSpanish_Nicaragua.phpSpanish_Panama.phpSpanish_Paraguay.phpSpanish_Peru.phpSpanish_Puerto_Rico.phpSpanish_Spain.phpSpanish_United_States.phpSpanish_Uruguay.phpSpanish_Venezuela.phpSwedish_Finland.phpSwedish_Sweden.phpTajik_(Cyrillic)_Tajikistan.phpTamazight_(Latin)_Algeria.phpTatar_Russia.phpTurkish_Turkey.phpTurkmen_Turkmenistan.phpUkrainian_Ukraine.phpUpper_Sorbian_Germany.phpUrdu_Islamic_Republic_of_Pakistan.phpUzbek_(Cyrillic)_Uzbekistan.phpUzbek_(Latin)_Uzbekistan.phpVietnamese_Vietnam.phpWelsh_United_Kingdom.phpWolof_Senegal.phpYakut_Russia.phpYoruba_Nigeria.phpisiXhosa_South_Africa.phpisiZulu_South_Africa.php
entity_substitutions.php
font
iccprofiles
lang2fonts.csslinebrdictK.datlinebrdictL.datlinebrdictT.datmpdf.cssno_image.jpgout.php
patterns
subs_core.phpsubs_win-1252.phpupperCase.php
phpunit.xmlruleset.xml
src
AssetFetcher.phpBarcode.php
Barcode
Cache.php
Color
Config
Container
Conversion
Css
CssManager.phpDirectWrite.php
Exception
File
Fonts
Form.phpFpdiTrait.php
Gif
Gradient.phpHTMLParserMode.php
Http
Hyphenator.php
Image
Language
Log
Mpdf.phpMpdfException.phpMpdfImageException.phpOtl.phpOtlDump.php
Output
PageBox.phpPageFormat.php
Pdf
ServiceFactory.php
Shaper
SizeConverter.phpStrict.phpTTFontFile.phpTTFontFileAnalysis.phpTableOfContents.phpTag.php
Tag
Ucdn.php
Utils
Watermark.phpWatermarkImage.phpWatermarkText.php
Writer
functions-dev.phpfunctions.php
ttfonts
psr-http-message-shim
psr-log-aware-trait
myclabs
nesbot
carbon
extension.neon
lazy
sponsors.php
src
Carbon
AbstractTranslator.phpCarbon.phpCarbonConverterInterface.phpCarbonImmutable.phpCarbonInterface.phpCarbonInterval.phpCarbonPeriod.phpCarbonPeriodImmutable.phpCarbonTimeZone.php
Cli
Doctrine
Exceptions
Factory.phpFactoryImmutable.php
Lang
aa.phpaa_DJ.phpaa_ER.phpaa_ER@saaho.phpaa_ET.phpaf.phpaf_NA.phpaf_ZA.phpagq.phpagr.phpagr_PE.phpak.phpak_GH.phpam.phpam_ET.phpan.phpan_ES.phpanp.phpanp_IN.phpar.phpar_AE.phpar_BH.phpar_DJ.phpar_DZ.phpar_EG.phpar_EH.phpar_ER.phpar_IL.phpar_IN.phpar_IQ.phpar_JO.phpar_KM.phpar_KW.phpar_LB.phpar_LY.phpar_MA.phpar_MR.phpar_OM.phpar_PS.phpar_QA.phpar_SA.phpar_SD.phpar_SO.phpar_SS.phpar_SY.phpar_Shakl.phpar_TD.phpar_TN.phpar_YE.phpas.phpas_IN.phpasa.phpast.phpast_ES.phpayc.phpayc_PE.phpaz.phpaz_AZ.phpaz_Cyrl.phpaz_IR.phpaz_Latn.phpbas.phpbe.phpbe_BY.phpbe_BY@latin.phpbem.phpbem_ZM.phpber.phpber_DZ.phpber_MA.phpbez.phpbg.phpbg_BG.phpbhb.phpbhb_IN.phpbho.phpbho_IN.phpbi.phpbi_VU.phpbm.phpbn.phpbn_BD.phpbn_IN.phpbo.phpbo_CN.phpbo_IN.phpbr.phpbr_FR.phpbrx.phpbrx_IN.phpbs.phpbs_BA.phpbs_Cyrl.phpbs_Latn.phpbyn.phpbyn_ER.phpca.phpca_AD.phpca_ES.phpca_ES_Valencia.phpca_FR.phpca_IT.phpccp.phpccp_IN.phpce.phpce_RU.phpcgg.phpchr.phpchr_US.phpckb.phpcmn.phpcmn_TW.phpcrh.phpcrh_UA.phpcs.phpcs_CZ.phpcsb.phpcsb_PL.phpcu.phpcv.phpcv_RU.phpcy.phpcy_GB.phpda.phpda_DK.phpda_GL.phpdav.phpde.phpde_AT.phpde_BE.phpde_CH.phpde_DE.phpde_IT.phpde_LI.phpde_LU.phpdje.phpdoi.phpdoi_IN.phpdsb.phpdsb_DE.phpdua.phpdv.phpdv_MV.phpdyo.phpdz.phpdz_BT.phpebu.phpee.phpee_TG.phpel.phpel_CY.phpel_GR.phpen.phpen_001.phpen_150.phpen_AG.phpen_AI.phpen_AS.phpen_AT.phpen_AU.phpen_BB.phpen_BE.phpen_BI.phpen_BM.phpen_BS.phpen_BW.phpen_BZ.phpen_CA.phpen_CC.phpen_CH.phpen_CK.phpen_CM.phpen_CX.phpen_CY.phpen_DE.phpen_DG.phpen_DK.phpen_DM.phpen_ER.phpen_FI.phpen_FJ.phpen_FK.phpen_FM.phpen_GB.phpen_GD.phpen_GG.phpen_GH.phpen_GI.phpen_GM.phpen_GU.phpen_GY.phpen_HK.phpen_IE.phpen_IL.phpen_IM.phpen_IN.phpen_IO.phpen_ISO.phpen_JE.phpen_JM.phpen_KE.phpen_KI.phpen_KN.phpen_KY.phpen_LC.phpen_LR.phpen_LS.phpen_MG.phpen_MH.phpen_MO.phpen_MP.phpen_MS.phpen_MT.phpen_MU.phpen_MW.phpen_MY.phpen_NA.phpen_NF.phpen_NG.phpen_NL.phpen_NR.phpen_NU.phpen_NZ.phpen_PG.phpen_PH.phpen_PK.phpen_PN.phpen_PR.phpen_PW.phpen_RW.phpen_SB.phpen_SC.phpen_SD.phpen_SE.phpen_SG.phpen_SH.phpen_SI.phpen_SL.phpen_SS.phpen_SX.phpen_SZ.phpen_TC.phpen_TK.phpen_TO.phpen_TT.phpen_TV.phpen_TZ.phpen_UG.phpen_UM.phpen_US.phpen_US_Posix.phpen_VC.phpen_VG.phpen_VI.phpen_VU.phpen_WS.phpen_ZA.phpen_ZM.phpen_ZW.phpeo.phpes.phpes_419.phpes_AR.phpes_BO.phpes_BR.phpes_BZ.phpes_CL.phpes_CO.phpes_CR.phpes_CU.phpes_DO.phpes_EA.phpes_EC.phpes_ES.phpes_GQ.phpes_GT.phpes_HN.phpes_IC.phpes_MX.phpes_NI.phpes_PA.phpes_PE.phpes_PH.phpes_PR.phpes_PY.phpes_SV.phpes_US.phpes_UY.phpes_VE.phpet.phpet_EE.phpeu.phpeu_ES.phpewo.phpfa.phpfa_AF.phpfa_IR.phpff.phpff_CM.phpff_GN.phpff_MR.phpff_SN.phpfi.phpfi_FI.phpfil.phpfil_PH.phpfo.phpfo_DK.phpfo_FO.phpfr.phpfr_BE.phpfr_BF.phpfr_BI.phpfr_BJ.phpfr_BL.phpfr_CA.phpfr_CD.phpfr_CF.phpfr_CG.phpfr_CH.phpfr_CI.phpfr_CM.phpfr_DJ.phpfr_DZ.phpfr_FR.phpfr_GA.phpfr_GF.phpfr_GN.phpfr_GP.phpfr_GQ.phpfr_HT.phpfr_KM.phpfr_LU.phpfr_MA.phpfr_MC.phpfr_MF.phpfr_MG.phpfr_ML.phpfr_MQ.phpfr_MR.phpfr_MU.phpfr_NC.phpfr_NE.phpfr_PF.phpfr_PM.phpfr_RE.phpfr_RW.phpfr_SC.phpfr_SN.phpfr_SY.phpfr_TD.phpfr_TG.phpfr_TN.phpfr_VU.phpfr_WF.phpfr_YT.phpfur.phpfur_IT.phpfy.phpfy_DE.phpfy_NL.phpga.phpga_IE.phpgd.phpgd_GB.phpgez.phpgez_ER.phpgez_ET.phpgl.phpgl_ES.phpgom.phpgom_Latn.phpgsw.phpgsw_CH.phpgsw_FR.phpgsw_LI.phpgu.phpgu_IN.phpguz.phpgv.phpgv_GB.phpha.phpha_GH.phpha_NE.phpha_NG.phphak.phphak_TW.phphaw.phphe.phphe_IL.phphi.phphi_IN.phphif.phphif_FJ.phphne.phphne_IN.phphr.phphr_BA.phphr_HR.phphsb.phphsb_DE.phpht.phpht_HT.phphu.phphu_HU.phphy.phphy_AM.phpi18n.phpia.phpia_FR.phpid.phpid_ID.phpig.phpig_NG.phpii.phpik.phpik_CA.phpin.phpis.phpis_IS.phpit.phpit_CH.phpit_IT.phpit_SM.phpit_VA.phpiu.phpiu_CA.phpiw.phpja.phpja_JP.phpjgo.phpjmc.phpjv.phpka.phpka_GE.phpkab.phpkab_DZ.phpkam.phpkde.phpkea.phpkhq.phpki.phpkk.phpkk_KZ.phpkkj.phpkl.phpkl_GL.phpkln.phpkm.phpkm_KH.phpkn.phpkn_IN.phpko.phpko_KP.phpko_KR.phpkok.phpkok_IN.phpks.phpks_IN.phpks_IN@devanagari.phpksb.phpksf.phpksh.phpku.phpku_TR.phpkw.phpkw_GB.phpky.phpky_KG.phplag.phplb.phplb_LU.phplg.phplg_UG.phpli.phpli_NL.phplij.phplij_IT.phplkt.phpln.phpln_AO.phpln_CD.phpln_CF.phpln_CG.phplo.phplo_LA.phplrc.phplrc_IQ.phplt.phplt_LT.phplu.phpluo.phpluy.phplv.phplv_LV.phplzh.phplzh_TW.phpmag.phpmag_IN.phpmai.phpmai_IN.phpmas.phpmas_TZ.phpmer.phpmfe.phpmfe_MU.phpmg.phpmg_MG.phpmgh.phpmgo.phpmhr.phpmhr_RU.phpmi.phpmi_NZ.phpmiq.phpmiq_NI.phpmjw.phpmjw_IN.phpmk.phpmk_MK.phpml.phpml_IN.phpmn.phpmn_MN.phpmni.phpmni_IN.phpmo.phpmr.phpmr_IN.phpms.phpms_BN.phpms_MY.phpms_SG.phpmt.phpmt_MT.phpmua.phpmy.phpmy_MM.phpmzn.phpnan.phpnan_TW.phpnan_TW@latin.phpnaq.phpnb.phpnb_NO.phpnb_SJ.phpnd.phpnds.phpnds_DE.phpnds_NL.phpne.phpne_IN.phpne_NP.phpnhn.phpnhn_MX.phpniu.phpniu_NU.phpnl.phpnl_AW.phpnl_BE.phpnl_BQ.phpnl_CW.phpnl_NL.phpnl_SR.phpnl_SX.phpnmg.phpnn.phpnn_NO.phpnnh.phpno.phpnr.phpnr_ZA.phpnso.phpnso_ZA.phpnus.phpnyn.phpoc.phpoc_FR.phpom.phpom_ET.phpom_KE.phpor.phpor_IN.phpos.phpos_RU.phppa.phppa_Arab.phppa_Guru.phppa_IN.phppa_PK.phppap.phppap_AW.phppap_CW.phppl.phppl_PL.phpprg.phpps.phpps_AF.phppt.phppt_AO.phppt_BR.phppt_CH.phppt_CV.phppt_GQ.phppt_GW.phppt_LU.phppt_MO.phppt_MZ.phppt_PT.phppt_ST.phppt_TL.phpqu.phpqu_BO.phpqu_EC.phpquz.phpquz_PE.phpraj.phpraj_IN.phprm.phprn.phpro.phpro_MD.phpro_RO.phprof.phpru.phpru_BY.phpru_KG.phpru_KZ.phpru_MD.phpru_RU.phpru_UA.phprw.phprw_RW.phprwk.phpsa.phpsa_IN.phpsah.phpsah_RU.phpsaq.phpsat.phpsat_IN.phpsbp.phpsc.phpsc_IT.phpsd.phpsd_IN.phpsd_IN@devanagari.phpse.phpse_FI.phpse_NO.phpse_SE.phpseh.phpses.phpsg.phpsgs.phpsgs_LT.phpsh.phpshi.phpshi_Latn.phpshi_Tfng.phpshn.phpshn_MM.phpshs.phpshs_CA.phpsi.phpsi_LK.phpsid.phpsid_ET.phpsk.phpsk_SK.phpsl.phpsl_SI.phpsm.phpsm_WS.phpsmn.phpsn.phpso.phpso_DJ.phpso_ET.phpso_KE.phpso_SO.phpsq.phpsq_AL.phpsq_MK.phpsq_XK.phpsr.phpsr_Cyrl.phpsr_Cyrl_BA.phpsr_Cyrl_ME.phpsr_Cyrl_XK.phpsr_Latn.phpsr_Latn_BA.phpsr_Latn_ME.phpsr_Latn_XK.phpsr_ME.phpsr_RS.phpsr_RS@latin.phpss.phpss_ZA.phpst.phpst_ZA.phpsv.phpsv_AX.phpsv_FI.phpsv_SE.phpsw.phpsw_CD.phpsw_KE.phpsw_TZ.phpsw_UG.phpszl.phpszl_PL.phpta.phpta_IN.phpta_LK.phpta_MY.phpta_SG.phptcy.phptcy_IN.phpte.phpte_IN.phpteo.phpteo_KE.phptet.phptg.phptg_TJ.phpth.phpth_TH.phpthe.phpthe_NP.phpti.phpti_ER.phpti_ET.phptig.phptig_ER.phptk.phptk_TM.phptl.phptl_PH.phptlh.phptn.phptn_ZA.phpto.phpto_TO.phptpi.phptpi_PG.phptr.phptr_CY.phptr_TR.phpts.phpts_ZA.phptt.phptt_RU.phptt_RU@iqtelif.phptwq.phptzl.phptzm.phptzm_Latn.phpug.phpug_CN.phpuk.phpuk_UA.phpunm.phpunm_US.phpur.phpur_IN.phpur_PK.phpuz.phpuz_Arab.phpuz_Cyrl.phpuz_Latn.phpuz_UZ.phpuz_UZ@cyrillic.phpvai.phpvai_Latn.phpvai_Vaii.phpve.phpve_ZA.phpvi.phpvi_VN.phpvo.phpvun.phpwa.phpwa_BE.phpwae.phpwae_CH.phpwal.phpwal_ET.phpwo.phpwo_SN.phpxh.phpxh_ZA.phpxog.phpyav.phpyi.phpyi_US.phpyo.phpyo_BJ.phpyo_NG.phpyue.phpyue_HK.phpyue_Hans.phpyue_Hant.phpyuw.phpyuw_PG.phpzgh.phpzh.phpzh_CN.phpzh_HK.phpzh_Hans.phpzh_Hans_HK.phpzh_Hans_MO.phpzh_Hans_SG.phpzh_Hant.phpzh_Hant_HK.phpzh_Hant_MO.phpzh_Hant_TW.phpzh_MO.phpzh_SG.phpzh_TW.phpzh_YUE.phpzu.phpzu_ZA.php
Laravel
List
MessageFormatter
PHPStan
Traits
Translator.phpTranslatorImmutable.phpTranslatorStrongTypeInterface.php
nyholm
pablo-sg-pacheco
paragonie
phpdocumentor
reflection-common
reflection-docblock
type-resolver
phpseclib
bcmath_compat
phpseclib
AUTHORS
phpseclib
Common
Functions
Crypt
AES.phpBlowfish.phpChaCha20.php
Common
DES.phpDH.php
DH
DSA.php
DSA
EC.php
EC
Hash.phpPublicKeyLoader.phpRC2.phpRC4.phpRSA.php
RSA
Random.phpRijndael.phpSalsa20.phpTripleDES.phpTwofish.php
Exception
File
ANSI.phpASN1.php
ASN1
Element.php
Maps
AccessDescription.phpAdministrationDomainName.phpAlgorithmIdentifier.phpAnotherName.phpAttribute.phpAttributeType.phpAttributeTypeAndValue.phpAttributeValue.phpAttributes.phpAuthorityInfoAccessSyntax.phpAuthorityKeyIdentifier.phpBaseDistance.phpBasicConstraints.phpBuiltInDomainDefinedAttribute.phpBuiltInDomainDefinedAttributes.phpBuiltInStandardAttributes.phpCPSuri.phpCRLDistributionPoints.phpCRLNumber.phpCRLReason.phpCertPolicyId.phpCertificate.phpCertificateIssuer.phpCertificateList.phpCertificatePolicies.phpCertificateSerialNumber.phpCertificationRequest.phpCertificationRequestInfo.phpCharacteristic_two.phpCountryName.phpCurve.phpDHParameter.phpDSAParams.phpDSAPrivateKey.phpDSAPublicKey.phpDigestInfo.phpDirectoryString.phpDisplayText.phpDistributionPoint.phpDistributionPointName.phpDssSigValue.phpECParameters.phpECPoint.phpECPrivateKey.phpEDIPartyName.phpEcdsaSigValue.phpEncryptedData.phpEncryptedPrivateKeyInfo.phpExtKeyUsageSyntax.phpExtension.phpExtensionAttribute.phpExtensionAttributes.phpExtensions.phpFieldElement.phpFieldID.phpGeneralName.phpGeneralNames.phpGeneralSubtree.phpGeneralSubtrees.phpHashAlgorithm.phpHoldInstructionCode.phpInvalidityDate.phpIssuerAltName.phpIssuingDistributionPoint.phpKeyIdentifier.phpKeyPurposeId.phpKeyUsage.phpMaskGenAlgorithm.phpName.phpNameConstraints.phpNetworkAddress.phpNoticeReference.phpNumericUserIdentifier.phpORAddress.phpOneAsymmetricKey.phpOrganizationName.phpOrganizationalUnitNames.phpOtherPrimeInfo.phpOtherPrimeInfos.phpPBEParameter.phpPBES2params.phpPBKDF2params.phpPBMAC1params.phpPKCS9String.phpPentanomial.phpPersonalName.phpPolicyInformation.phpPolicyMappings.phpPolicyQualifierId.phpPolicyQualifierInfo.phpPostalAddress.phpPrime_p.phpPrivateDomainName.phpPrivateKey.phpPrivateKeyInfo.phpPrivateKeyUsagePeriod.phpPublicKey.phpPublicKeyAndChallenge.phpPublicKeyInfo.phpRC2CBCParameter.phpRDNSequence.phpRSAPrivateKey.phpRSAPublicKey.phpRSASSA_PSS_params.phpReasonFlags.phpRelativeDistinguishedName.phpRevokedCertificate.phpSignedPublicKeyAndChallenge.phpSpecifiedECDomain.phpSubjectAltName.phpSubjectDirectoryAttributes.phpSubjectInfoAccessSyntax.phpSubjectPublicKeyInfo.phpTBSCertList.phpTBSCertificate.phpTerminalIdentifier.phpTime.phpTrinomial.phpUniqueIdentifier.phpUserNotice.phpValidity.phpnetscape_ca_policy_url.phpnetscape_cert_type.phpnetscape_comment.php
X509.php
Math
Net
System
bootstrap.phpopenssl.cnf
phpstan
phpdoc-parser
phpstan-baseline.neon
src
Ast
AbstractNodeVisitor.phpAttribute.php
ConstExpr
Node.phpNodeAttributes.phpNodeTraverser.phpNodeVisitor.php
NodeVisitor
PhpDoc
Type
Lexer
Parser
Printer
psr
rakit
ralouphie
getallheaders
remotelyliving
rpnzl
scoper-autoload.php
scssphp
setasign
spatie
stripe
stripe-php
OPENAPI_VERSIONVERSION
data
init.php
lib
Account.phpAccountLink.php
ApiOperations
ApiRequestor.phpApiResource.phpApiResponse.phpApplePayDomain.phpApplicationFee.phpApplicationFeeRefund.php
Apps
Balance.phpBalanceTransaction.phpBankAccount.phpBaseStripeClient.phpBaseStripeClientInterface.php
BillingPortal
Capability.phpCard.phpCashBalance.phpCharge.php
Checkout
Collection.phpCountrySpec.phpCoupon.phpCreditNote.phpCreditNoteLineItem.phpCustomer.phpCustomerBalanceTransaction.phpCustomerCashBalanceTransaction.phpDiscount.phpDispute.phpEphemeralKey.phpErrorObject.phpEvent.php
Exception
ExchangeRate.phpFile.phpFileLink.php
FinancialConnections
FundingInstructions.php
HttpClient
Identity
Invoice.phpInvoiceItem.phpInvoiceLineItem.php
Issuing
LineItem.phpLoginLink.phpMandate.phpOAuth.phpOAuthErrorObject.phpPaymentIntent.phpPaymentLink.phpPaymentMethod.phpPayout.phpPerson.phpPlan.phpPrice.phpProduct.phpPromotionCode.phpQuote.php
Radar
RecipientTransfer.phpRefund.php
Reporting
RequestTelemetry.phpReview.phpSearchResult.php
Service
AbstractService.phpAbstractServiceFactory.phpAccountLinkService.phpAccountService.phpApplePayDomainService.phpApplicationFeeService.php
Apps
BalanceService.phpBalanceTransactionService.php
BillingPortal
ChargeService.php
Checkout
CoreServiceFactory.phpCountrySpecService.phpCouponService.phpCreditNoteService.phpCustomerService.phpDisputeService.phpEphemeralKeyService.phpEventService.phpExchangeRateService.phpFileLinkService.phpFileService.php
FinancialConnections
Identity
InvoiceItemService.phpInvoiceService.php
Issuing
MandateService.phpOAuthService.phpPaymentIntentService.phpPaymentLinkService.phpPaymentMethodService.phpPayoutService.phpPlanService.phpPriceService.phpProductService.phpPromotionCodeService.phpQuoteService.php
Radar
RefundService.php
Reporting
ReviewService.phpSetupAttemptService.phpSetupIntentService.phpShippingRateService.php
Sigma
SourceService.phpSubscriptionItemService.phpSubscriptionScheduleService.phpSubscriptionService.php
Tax
TaxCodeService.phpTaxRateService.php
Terminal
TestHelpers
TokenService.phpTopupService.phpTransferService.php
Treasury
WebhookEndpointService.php
SetupAttempt.phpSetupIntent.phpShippingRate.php
Sigma
SingletonApiResource.phpSource.phpSourceTransaction.phpStripe.phpStripeClient.phpStripeClientInterface.phpStripeObject.phpStripeStreamingClientInterface.phpSubscription.phpSubscriptionItem.phpSubscriptionSchedule.php
Tax
TaxCode.phpTaxId.phpTaxRate.php
Terminal
TestHelpers
Token.phpTopup.phpTransfer.phpTransferReversal.php
Treasury
UsageRecord.phpUsageRecordSummary.php
Util
Webhook.phpWebhookEndpoint.phpWebhookSignature.php
symfony
cache-contracts
cache
deprecation-contracts
event-dispatcher-contracts
event-dispatcher
polyfill-mbstring
polyfill-php73
polyfill-php80
polyfill-php81
process
service-contracts
translation-contracts
translation
Catalogue
CatalogueMetadataAwareInterface.php
Command
DataCollector
DataCollectorTranslator.php
DependencyInjection
Dumper
Exception
Extractor
Formatter
IdentityTranslator.php
Loader
LocaleSwitcher.phpLoggingTranslator.phpMessageCatalogue.phpMessageCatalogueInterface.phpMetadataAwareInterface.php
Provider
PseudoLocalizationTranslator.php
Reader
Resources
Test
TranslatableMessage.phpTranslator.phpTranslatorBag.phpTranslatorBagInterface.php
Util
Writer
var-exporter
webmozart
woocommerce
action-scheduler
action-scheduler.php
classes
ActionScheduler_ActionClaim.phpActionScheduler_ActionFactory.phpActionScheduler_AdminView.phpActionScheduler_AsyncRequest_QueueRunner.phpActionScheduler_Compatibility.phpActionScheduler_DataController.phpActionScheduler_DateTime.phpActionScheduler_Exception.phpActionScheduler_FatalErrorMonitor.phpActionScheduler_InvalidActionException.phpActionScheduler_ListTable.phpActionScheduler_LogEntry.phpActionScheduler_NullLogEntry.phpActionScheduler_OptionLock.phpActionScheduler_QueueCleaner.phpActionScheduler_QueueRunner.phpActionScheduler_Versions.phpActionScheduler_WPCommentCleaner.phpActionScheduler_wcSystemStatus.php
WP_CLI
abstracts
actions
data-stores
migration
schedules
schema
deprecated
functions.php
lib
yahnis-elsts
inc
admin-pages
class-about-admin-page.phpclass-addons-admin-page.phpclass-base-admin-page.phpclass-base-customer-facing-admin-page.phpclass-broadcast-edit-admin-page.phpclass-broadcast-list-admin-page.phpclass-checkout-form-edit-admin-page.phpclass-checkout-form-list-admin-page.phpclass-customer-edit-admin-page.phpclass-customer-list-admin-page.phpclass-customizer-admin-page.phpclass-dashboard-admin-page.phpclass-discount-code-edit-admin-page.phpclass-discount-code-list-admin-page.phpclass-domain-edit-admin-page.phpclass-domain-list-admin-page.phpclass-edit-admin-page.phpclass-email-edit-admin-page.phpclass-email-list-admin-page.phpclass-email-template-customize-admin-page.phpclass-event-list-admin-page.phpclass-event-view-admin-page.phpclass-hosting-integration-wizard-admin-page.phpclass-invoice-template-customize-admin-page.phpclass-jobs-list-admin-page.phpclass-list-admin-page.phpclass-membership-edit-admin-page.phpclass-membership-list-admin-page.phpclass-migration-alert-admin-page.phpclass-payment-edit-admin-page.phpclass-payment-list-admin-page.phpclass-placeholders-admin-page.phpclass-product-edit-admin-page.phpclass-product-list-admin-page.phpclass-rollback-admin-page.phpclass-settings-admin-page.phpclass-setup-wizard-admin-page.phpclass-shortcodes-admin-page.phpclass-site-edit-admin-page.phpclass-site-list-admin-page.phpclass-system-info-admin-page.phpclass-tax-rates-admin-page.phpclass-template-previewer-customize-admin-page.phpclass-top-admin-nav-menu.phpclass-view-logs-admin-page.phpclass-webhook-edit-admin-page.phpclass-webhook-list-admin-page.phpclass-wizard-admin-page.php
customer-panel
debug
api
builders
checkout
class-cart.phpclass-checkout-pages.phpclass-checkout.phpclass-legacy-checkout.phpclass-line-item.php
signup-fields
class-admin-notices.phpclass-admin-themes-compatibility.phpclass-ajax.phpclass-api.phpclass-async-calls.phpclass-autoloader.phpclass-core-updates.phpclass-cron.phpclass-current.phpclass-dashboard-statistics.phpclass-dashboard-widgets.phpclass-documentation.phpclass-domain-mapping.phpclass-faker.phpclass-geolocation.phpclass-helper.phpclass-hooks.phpclass-license.phpclass-light-ajax.phpclass-logger.phpclass-maintenance-mode.phpclass-requirements.phpclass-scripts.phpclass-session-cookie.phpclass-settings.phpclass-sunrise.phpclass-unsupported.phpclass-user-switching.phpclass-views.phpclass-whitelabel.phpclass-wp-ultimo.php
compat
contracts
country
br
ca
class-country-br.phpclass-country-ca.phpclass-country-cn.phpclass-country-de.phpclass-country-default.phpclass-country-es.phpclass-country-fr.phpclass-country-gb.phpclass-country-in.phpclass-country-jp.phpclass-country-mx.phpclass-country-my.phpclass-country-ne.phpclass-country-nl.phpclass-country-ru.phpclass-country-sg.phpclass-country-tr.phpclass-country-us.phpclass-country-za.phpclass-country.php
cn
de
es
fr
gb
in
jp
mx
my
ne
nl
ru
sg
tr
us
za
database
debug
deprecated
development
domain-mapping
duplication
exception
functions
gateways
helpers
installers
integrations
internal
invoices
limitations
limits
list-tables
loaders
managers
mercator
models
next
objects
rollback
site-templates
sso
tax
traits
ui
updater
lang
loco.xmlreadme.txtsunrise.phpuninstall.php
views
about.phpadmin-notices.php
admin-pages
base
broadcast
checkout
classes.php
customers
dashboard-statistics
dashboard-widgets
domain
dynamic-styles
email
emails
events
invoice
legacy
limitations
memberships
payments
phpcs.xml
rollback
settings
shortcodes
sites
system-info
taxes
ui
wizards
wp-multisite-waas.php

@@ -0,0 +1,51 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream\Base64;
use WP_Ultimo\Dependencies\Amp\ByteStream\InputStream;
use WP_Ultimo\Dependencies\Amp\ByteStream\StreamException;
use WP_Ultimo\Dependencies\Amp\Promise;
use function WP_Ultimo\Dependencies\Amp\call;
final class Base64DecodingInputStream implements InputStream
{
/** @var InputStream|null */
private $source;
/** @var string|null */
private $buffer = '';
public function __construct(InputStream $source)
{
$this->source = $source;
}
public function read() : Promise
{
return call(function () {
if ($this->source === null) {
throw new StreamException('Failed to read stream chunk due to invalid base64 data');
}
$chunk = (yield $this->source->read());
if ($chunk === null) {
if ($this->buffer === null) {
return null;
}
$chunk = \base64_decode($this->buffer, \true);
if ($chunk === \false) {
$this->source = null;
$this->buffer = null;
throw new StreamException('Failed to read stream chunk due to invalid base64 data');
}
$this->buffer = null;
return $chunk;
}
$this->buffer .= $chunk;
$length = \strlen($this->buffer);
$chunk = \base64_decode(\substr($this->buffer, 0, $length - $length % 4), \true);
if ($chunk === \false) {
$this->source = null;
$this->buffer = null;
throw new StreamException('Failed to read stream chunk due to invalid base64 data');
}
$this->buffer = \substr($this->buffer, $length - $length % 4);
return $chunk;
});
}
}

@@ -0,0 +1,43 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream\Base64;
use WP_Ultimo\Dependencies\Amp\ByteStream\OutputStream;
use WP_Ultimo\Dependencies\Amp\ByteStream\StreamException;
use WP_Ultimo\Dependencies\Amp\Failure;
use WP_Ultimo\Dependencies\Amp\Promise;
final class Base64DecodingOutputStream implements OutputStream
{
/** @var OutputStream */
private $destination;
/** @var string */
private $buffer = '';
/** @var int */
private $offset = 0;
public function __construct(OutputStream $destination)
{
$this->destination = $destination;
}
public function write(string $data) : Promise
{
$this->buffer .= $data;
$length = \strlen($this->buffer);
$chunk = \base64_decode(\substr($this->buffer, 0, $length - $length % 4), \true);
if ($chunk === \false) {
return new Failure(new StreamException('Invalid base64 near offset ' . $this->offset));
}
$this->offset += $length - $length % 4;
$this->buffer = \substr($this->buffer, $length - $length % 4);
return $this->destination->write($chunk);
}
public function end(string $finalData = "") : Promise
{
$this->offset += \strlen($this->buffer);
$chunk = \base64_decode($this->buffer . $finalData, \true);
if ($chunk === \false) {
return new Failure(new StreamException('Invalid base64 near offset ' . $this->offset));
}
$this->buffer = '';
return $this->destination->end($chunk);
}
}

@@ -0,0 +1,37 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream\Base64;
use WP_Ultimo\Dependencies\Amp\ByteStream\InputStream;
use WP_Ultimo\Dependencies\Amp\Promise;
use function WP_Ultimo\Dependencies\Amp\call;
final class Base64EncodingInputStream implements InputStream
{
/** @var InputStream */
private $source;
/** @var string|null */
private $buffer = '';
public function __construct(InputStream $source)
{
$this->source = $source;
}
public function read() : Promise
{
return call(function () {
$chunk = (yield $this->source->read());
if ($chunk === null) {
if ($this->buffer === null) {
return null;
}
$chunk = \base64_encode($this->buffer);
$this->buffer = null;
return $chunk;
}
$this->buffer .= $chunk;
$length = \strlen($this->buffer);
$chunk = \base64_encode(\substr($this->buffer, 0, $length - $length % 3));
$this->buffer = \substr($this->buffer, $length - $length % 3);
return $chunk;
});
}
}

@@ -0,0 +1,31 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream\Base64;
use WP_Ultimo\Dependencies\Amp\ByteStream\OutputStream;
use WP_Ultimo\Dependencies\Amp\Promise;
final class Base64EncodingOutputStream implements OutputStream
{
/** @var OutputStream */
private $destination;
/** @var string */
private $buffer = '';
public function __construct(OutputStream $destination)
{
$this->destination = $destination;
}
public function write(string $data) : Promise
{
$this->buffer .= $data;
$length = \strlen($this->buffer);
$chunk = \base64_encode(\substr($this->buffer, 0, $length - $length % 3));
$this->buffer = \substr($this->buffer, $length - $length % 3);
return $this->destination->write($chunk);
}
public function end(string $finalData = "") : Promise
{
$chunk = \base64_encode($this->buffer . $finalData);
$this->buffer = '';
return $this->destination->end($chunk);
}
}

@@ -0,0 +1,7 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
final class ClosedException extends StreamException
{
}

@@ -0,0 +1,34 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
use WP_Ultimo\Dependencies\Amp\Success;
/**
* Input stream with a single already known data chunk.
*/
final class InMemoryStream implements InputStream
{
private $contents;
/**
* @param string|null $contents Data chunk or `null` for no data chunk.
*/
public function __construct(string $contents = null)
{
$this->contents = $contents;
}
/**
* Reads data from the stream.
*
* @return Promise<string|null> Resolves with the full contents or `null` if the stream has closed / already been consumed.
*/
public function read() : Promise
{
if ($this->contents === null) {
return new Success();
}
$promise = new Success($this->contents);
$this->contents = null;
return $promise;
}
}

@@ -0,0 +1,37 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
/**
* An `InputStream` allows reading byte streams in chunks.
*
* **Example**
*
* ```php
* function readAll(InputStream $in): Promise {
* return Amp\call(function () use ($in) {
* $buffer = "";
*
* while (($chunk = yield $in->read()) !== null) {
* $buffer .= $chunk;
* }
*
* return $buffer;
* });
* }
* ```
*/
interface InputStream
{
/**
* Reads data from the stream.
*
* @return Promise Resolves with a string when new data is available or `null` if the stream has closed.
*
* @psalm-return Promise<string|null>
*
* @throws PendingReadError Thrown if another read operation is still pending.
*/
public function read() : Promise;
}

@@ -0,0 +1,44 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
use WP_Ultimo\Dependencies\Amp\Success;
use function WP_Ultimo\Dependencies\Amp\call;
final class InputStreamChain implements InputStream
{
/** @var InputStream[] */
private $streams;
/** @var bool */
private $reading = \false;
public function __construct(InputStream ...$streams)
{
$this->streams = $streams;
}
/** @inheritDoc */
public function read() : Promise
{
if ($this->reading) {
throw new PendingReadError();
}
if (!$this->streams) {
return new Success(null);
}
return call(function () {
$this->reading = \true;
try {
while ($this->streams) {
$chunk = (yield $this->streams[0]->read());
if ($chunk === null) {
\array_shift($this->streams);
continue;
}
return $chunk;
}
return null;
} finally {
$this->reading = \false;
}
});
}
}

@@ -0,0 +1,55 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Deferred;
use WP_Ultimo\Dependencies\Amp\Failure;
use WP_Ultimo\Dependencies\Amp\Iterator;
use WP_Ultimo\Dependencies\Amp\Promise;
final class IteratorStream implements InputStream
{
/** @var Iterator<string> */
private $iterator;
/** @var \Throwable|null */
private $exception;
/** @var bool */
private $pending = \false;
/**
* @psam-param Iterator<string> $iterator
*/
public function __construct(Iterator $iterator)
{
$this->iterator = $iterator;
}
/** @inheritdoc */
public function read() : Promise
{
if ($this->exception) {
return new Failure($this->exception);
}
if ($this->pending) {
throw new PendingReadError();
}
$this->pending = \true;
/** @var Deferred<string|null> $deferred */
$deferred = new Deferred();
$this->iterator->advance()->onResolve(function ($error, $hasNextElement) use($deferred) {
$this->pending = \false;
if ($error) {
$this->exception = $error;
$deferred->fail($error);
} elseif ($hasNextElement) {
$chunk = $this->iterator->getCurrent();
if (!\is_string($chunk)) {
$this->exception = new StreamException(\sprintf("Unexpected iterator value of type '%s', expected string", \is_object($chunk) ? \get_class($chunk) : \gettype($chunk)));
$deferred->fail($this->exception);
return;
}
$deferred->resolve($chunk);
} else {
$deferred->resolve();
}
});
return $deferred->promise();
}
}

@@ -0,0 +1,59 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
use function WP_Ultimo\Dependencies\Amp\call;
final class LineReader
{
/** @var string */
private $delimiter;
/** @var bool */
private $lineMode;
/** @var string */
private $buffer = "";
/** @var InputStream */
private $source;
public function __construct(InputStream $inputStream, string $delimiter = null)
{
$this->source = $inputStream;
$this->delimiter = $delimiter === null ? "\n" : $delimiter;
$this->lineMode = $delimiter === null;
}
/**
* @return Promise<string|null>
*/
public function readLine() : Promise
{
return call(function () {
if (\false !== \strpos($this->buffer, $this->delimiter)) {
list($line, $this->buffer) = \explode($this->delimiter, $this->buffer, 2);
return $this->lineMode ? \rtrim($line, "\r") : $line;
}
while (null !== ($chunk = (yield $this->source->read()))) {
$this->buffer .= $chunk;
if (\false !== \strpos($this->buffer, $this->delimiter)) {
list($line, $this->buffer) = \explode($this->delimiter, $this->buffer, 2);
return $this->lineMode ? \rtrim($line, "\r") : $line;
}
}
if ($this->buffer === "") {
return null;
}
$line = $this->buffer;
$this->buffer = "";
return $this->lineMode ? \rtrim($line, "\r") : $line;
});
}
public function getBuffer() : string
{
return $this->buffer;
}
/**
* @return void
*/
public function clearBuffer()
{
$this->buffer = "";
}
}

@@ -0,0 +1,151 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Coroutine;
use WP_Ultimo\Dependencies\Amp\Deferred;
use WP_Ultimo\Dependencies\Amp\Failure;
use WP_Ultimo\Dependencies\Amp\Promise;
use WP_Ultimo\Dependencies\Amp\Success;
/**
* Creates a buffered message from an InputStream. The message can be consumed in chunks using the read() API or it may
* be buffered and accessed in its entirety by waiting for the promise to resolve.
*
* Other implementations may extend this class to add custom properties such as a `isBinary()` flag for WebSocket
* messages.
*
* Buffering Example:
*
* $stream = new Message($inputStream);
* $content = yield $stream;
*
* Streaming Example:
*
* $stream = new Message($inputStream);
*
* while (($chunk = yield $stream->read()) !== null) {
* // Immediately use $chunk, reducing memory consumption since the entire message is never buffered.
* }
*
* @deprecated Use Amp\ByteStream\Payload instead.
*/
class Message implements InputStream, Promise
{
/** @var InputStream */
private $source;
/** @var string */
private $buffer = "";
/** @var Deferred|null */
private $pendingRead;
/** @var Coroutine|null */
private $coroutine;
/** @var bool True if onResolve() has been called. */
private $buffering = \false;
/** @var Deferred|null */
private $backpressure;
/** @var bool True if the iterator has completed. */
private $complete = \false;
/** @var \Throwable|null Used to fail future reads on failure. */
private $error;
/**
* @param InputStream $source An iterator that only emits strings.
*/
public function __construct(InputStream $source)
{
$this->source = $source;
}
private function consume() : \Generator
{
while (($chunk = (yield $this->source->read())) !== null) {
$buffer = $this->buffer .= $chunk;
if ($buffer === "") {
continue;
// Do not succeed reads with empty string.
} elseif ($this->pendingRead) {
$deferred = $this->pendingRead;
$this->pendingRead = null;
$this->buffer = "";
$deferred->resolve($buffer);
$buffer = "";
// Destroy last emitted chunk to free memory.
} elseif (!$this->buffering) {
$buffer = "";
// Destroy last emitted chunk to free memory.
$this->backpressure = new Deferred();
(yield $this->backpressure->promise());
}
}
$this->complete = \true;
if ($this->pendingRead) {
$deferred = $this->pendingRead;
$this->pendingRead = null;
$deferred->resolve($this->buffer !== "" ? $this->buffer : null);
$this->buffer = "";
}
return $this->buffer;
}
/** @inheritdoc */
public final function read() : Promise
{
if ($this->pendingRead) {
throw new PendingReadError();
}
if ($this->coroutine === null) {
$this->coroutine = new Coroutine($this->consume());
$this->coroutine->onResolve(function ($error) {
if ($error) {
$this->error = $error;
}
if ($this->pendingRead) {
$deferred = $this->pendingRead;
$this->pendingRead = null;
$deferred->fail($error);
}
});
}
if ($this->error) {
return new Failure($this->error);
}
if ($this->buffer !== "") {
$buffer = $this->buffer;
$this->buffer = "";
if ($this->backpressure) {
$backpressure = $this->backpressure;
$this->backpressure = null;
$backpressure->resolve();
}
return new Success($buffer);
}
if ($this->complete) {
return new Success();
}
$this->pendingRead = new Deferred();
return $this->pendingRead->promise();
}
/** @inheritdoc */
public final function onResolve(callable $onResolved)
{
$this->buffering = \true;
if ($this->coroutine === null) {
$this->coroutine = new Coroutine($this->consume());
}
if ($this->backpressure) {
$backpressure = $this->backpressure;
$this->backpressure = null;
$backpressure->resolve();
}
$this->coroutine->onResolve($onResolved);
}
/**
* Exposes the source input stream.
*
* This might be required to resolve a promise with an InputStream, because promises in Amp can't be resolved with
* other promises.
*
* @return InputStream
*/
public final function getInputStream() : InputStream
{
return $this->source;
}
}

@@ -0,0 +1,43 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Deferred;
use WP_Ultimo\Dependencies\Amp\Promise;
use WP_Ultimo\Dependencies\Amp\Success;
class OutputBuffer implements OutputStream, Promise
{
/** @var Deferred */
private $deferred;
/** @var string */
private $contents = '';
/** @var bool */
private $closed = \false;
public function __construct()
{
$this->deferred = new Deferred();
}
public function write(string $data) : Promise
{
if ($this->closed) {
throw new ClosedException("The stream has already been closed.");
}
$this->contents .= $data;
return new Success(\strlen($data));
}
public function end(string $finalData = "") : Promise
{
if ($this->closed) {
throw new ClosedException("The stream has already been closed.");
}
$this->contents .= $finalData;
$this->closed = \true;
$this->deferred->resolve($this->contents);
$this->contents = "";
return new Success(\strlen($finalData));
}
public function onResolve(callable $onResolved)
{
$this->deferred->promise()->onResolve($onResolved);
}
}

@@ -0,0 +1,35 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
/**
* An `OutputStream` allows writing data in chunks. Writers can wait on the returned promises to feel the backpressure.
*/
interface OutputStream
{
/**
* Writes data to the stream.
*
* @param string $data Bytes to write.
*
* @return Promise Succeeds once the data has been successfully written to the stream.
*
* @throws ClosedException If the stream has already been closed.
* @throws StreamException If writing to the stream fails.
*/
public function write(string $data) : Promise;
/**
* Marks the stream as no longer writable. Optionally writes a final data chunk before. Note that this is not the
* same as forcefully closing the stream. This method waits for all pending writes to complete before closing the
* stream. Socket streams implementing this interface should only close the writable side of the stream.
*
* @param string $finalData Bytes to write.
*
* @return Promise Succeeds once the data has been successfully written to the stream.
*
* @throws ClosedException If the stream has already been closed.
* @throws StreamException If writing to the stream fails.
*/
public function end(string $finalData = "") : Promise;
}

@@ -0,0 +1,80 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Coroutine;
use WP_Ultimo\Dependencies\Amp\Promise;
use function WP_Ultimo\Dependencies\Amp\call;
/**
* Creates a buffered message from an InputStream. The message can be consumed in chunks using the read() API or it may
* be buffered and accessed in its entirety by calling buffer(). Once buffering is requested through buffer(), the
* stream cannot be read in chunks. On destruct any remaining data is read from the InputStream given to this class.
*/
class Payload implements InputStream
{
/** @var InputStream */
private $stream;
/** @var \Amp\Promise|null */
private $promise;
/** @var \Amp\Promise|null */
private $lastRead;
/**
* @param \Amp\ByteStream\InputStream $stream
*/
public function __construct(InputStream $stream)
{
$this->stream = $stream;
}
public function __destruct()
{
if (!$this->promise) {
Promise\rethrow(new Coroutine($this->consume()));
}
}
private function consume() : \Generator
{
try {
if ($this->lastRead && null === (yield $this->lastRead)) {
return;
}
while (null !== (yield $this->stream->read())) {
// Discard unread bytes from message.
}
} catch (\Throwable $exception) {
// If exception is thrown here the connection closed anyway.
}
}
/**
* @inheritdoc
*
* @throws \Error If a buffered message was requested by calling buffer().
*/
public final function read() : Promise
{
if ($this->promise) {
throw new \Error("Cannot stream message data once a buffered message has been requested");
}
return $this->lastRead = $this->stream->read();
}
/**
* Buffers the entire message and resolves the returned promise then.
*
* @return Promise<string> Resolves with the entire message contents.
*/
public final function buffer() : Promise
{
if ($this->promise) {
return $this->promise;
}
return $this->promise = call(function () {
$buffer = '';
if ($this->lastRead && null === (yield $this->lastRead)) {
return $buffer;
}
while (null !== ($chunk = (yield $this->stream->read()))) {
$buffer .= $chunk;
}
return $buffer;
});
}
}

@@ -0,0 +1,14 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
/**
* Thrown in case a second read operation is attempted while another read operation is still pending.
*/
final class PendingReadError extends \Error
{
public function __construct(string $message = "The previous read operation must complete before read can be called again", int $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

@@ -0,0 +1,211 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Deferred;
use WP_Ultimo\Dependencies\Amp\Loop;
use WP_Ultimo\Dependencies\Amp\Promise;
use WP_Ultimo\Dependencies\Amp\Success;
/**
* Input stream abstraction for PHP's stream resources.
*/
final class ResourceInputStream implements InputStream
{
const DEFAULT_CHUNK_SIZE = 8192;
/** @var resource|null */
private $resource;
/** @var string */
private $watcher;
/** @var Deferred|null */
private $deferred;
/** @var bool */
private $readable = \true;
/** @var int */
private $chunkSize;
/** @var bool */
private $useSingleRead;
/** @var callable */
private $immediateCallable;
/** @var string|null */
private $immediateWatcher;
/**
* @param resource $stream Stream resource.
* @param int $chunkSize Chunk size per read operation.
*
* @throws \Error If an invalid stream or parameter has been passed.
*/
public function __construct($stream, int $chunkSize = self::DEFAULT_CHUNK_SIZE)
{
if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') {
throw new \Error("Expected a valid stream");
}
$meta = \stream_get_meta_data($stream);
$useSingleRead = $meta["stream_type"] === "udp_socket" || $meta["stream_type"] === "STDIO";
$this->useSingleRead = $useSingleRead;
if (\strpos($meta["mode"], "r") === \false && \strpos($meta["mode"], "+") === \false) {
throw new \Error("Expected a readable stream");
}
\stream_set_blocking($stream, \false);
\stream_set_read_buffer($stream, 0);
$this->resource =& $stream;
$this->chunkSize =& $chunkSize;
$deferred =& $this->deferred;
$readable =& $this->readable;
$this->watcher = Loop::onReadable($this->resource, static function ($watcher) use(&$deferred, &$readable, &$stream, &$chunkSize, $useSingleRead) {
if ($useSingleRead) {
$data = @\fread($stream, $chunkSize);
} else {
$data = @\stream_get_contents($stream, $chunkSize);
}
\assert($data !== \false, "Trying to read from a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to.");
// Error suppression, because pthreads does crazy things with resources,
// which might be closed during two operations.
// See https://github.com/amphp/byte-stream/issues/32
if ($data === '' && @\feof($stream)) {
$readable = \false;
$stream = null;
$data = null;
// Stream closed, resolve read with null.
Loop::cancel($watcher);
} else {
Loop::disable($watcher);
}
$temp = $deferred;
$deferred = null;
\assert($temp instanceof Deferred);
$temp->resolve($data);
});
$this->immediateCallable = static function ($watcherId, $data) use(&$deferred) {
$temp = $deferred;
$deferred = null;
\assert($temp instanceof Deferred);
$temp->resolve($data);
};
Loop::disable($this->watcher);
}
/** @inheritdoc */
public function read() : Promise
{
if ($this->deferred !== null) {
throw new PendingReadError();
}
if (!$this->readable) {
return new Success();
// Resolve with null on closed stream.
}
\assert($this->resource !== null);
// Attempt a direct read, because Windows suffers from slow I/O on STDIN otherwise.
if ($this->useSingleRead) {
$data = @\fread($this->resource, $this->chunkSize);
} else {
$data = @\stream_get_contents($this->resource, $this->chunkSize);
}
\assert($data !== \false, "Trying to read from a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to.");
if ($data === '') {
// Error suppression, because pthreads does crazy things with resources,
// which might be closed during two operations.
// See https://github.com/amphp/byte-stream/issues/32
if (@\feof($this->resource)) {
$this->readable = \false;
$this->resource = null;
Loop::cancel($this->watcher);
return new Success();
// Stream closed, resolve read with null.
}
$this->deferred = new Deferred();
Loop::enable($this->watcher);
return $this->deferred->promise();
}
// Prevent an immediate read → write loop from blocking everything
// See e.g. examples/benchmark-throughput.php
$this->deferred = new Deferred();
$this->immediateWatcher = Loop::defer($this->immediateCallable, $data);
return $this->deferred->promise();
}
/**
* Closes the stream forcefully. Multiple `close()` calls are ignored.
*
* @return void
*/
public function close()
{
if (\is_resource($this->resource)) {
// Error suppression, as resource might already be closed
$meta = @\stream_get_meta_data($this->resource);
if ($meta && \strpos($meta["mode"], "+") !== \false) {
@\stream_socket_shutdown($this->resource, \STREAM_SHUT_RD);
} else {
/** @psalm-suppress InvalidPropertyAssignmentValue */
@\fclose($this->resource);
}
}
$this->free();
}
/**
* Nulls reference to resource, marks stream unreadable, and succeeds any pending read with null.
*
* @return void
*/
private function free()
{
$this->readable = \false;
$this->resource = null;
if ($this->deferred !== null) {
$deferred = $this->deferred;
$this->deferred = null;
$deferred->resolve();
}
Loop::cancel($this->watcher);
if ($this->immediateWatcher !== null) {
Loop::cancel($this->immediateWatcher);
}
}
/**
* @return resource|null The stream resource or null if the stream has closed.
*/
public function getResource()
{
return $this->resource;
}
/**
* @return void
*/
public function setChunkSize(int $chunkSize)
{
$this->chunkSize = $chunkSize;
}
/**
* References the read watcher, so the loop keeps running in case there's an active read.
*
* @return void
*
* @see Loop::reference()
*/
public function reference()
{
if (!$this->resource) {
throw new \Error("Resource has already been freed");
}
Loop::reference($this->watcher);
}
/**
* Unreferences the read watcher, so the loop doesn't keep running even if there are active reads.
*
* @return void
*
* @see Loop::unreference()
*/
public function unreference()
{
if (!$this->resource) {
throw new \Error("Resource has already been freed");
}
Loop::unreference($this->watcher);
}
public function __destruct()
{
if ($this->resource !== null) {
$this->free();
}
}
}

@@ -0,0 +1,270 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Deferred;
use WP_Ultimo\Dependencies\Amp\Failure;
use WP_Ultimo\Dependencies\Amp\Loop;
use WP_Ultimo\Dependencies\Amp\Promise;
use WP_Ultimo\Dependencies\Amp\Success;
/**
* Output stream abstraction for PHP's stream resources.
*/
final class ResourceOutputStream implements OutputStream
{
const MAX_CONSECUTIVE_EMPTY_WRITES = 3;
const LARGE_CHUNK_SIZE = 128 * 1024;
/** @var resource|null */
private $resource;
/** @var string */
private $watcher;
/** @var \SplQueue<array> */
private $writes;
/** @var bool */
private $writable = \true;
/** @var int|null */
private $chunkSize;
/**
* @param resource $stream Stream resource.
* @param int|null $chunkSize Chunk size per `fwrite()` operation.
*/
public function __construct($stream, int $chunkSize = null)
{
if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') {
throw new \Error("Expected a valid stream");
}
$meta = \stream_get_meta_data($stream);
if (\strpos($meta["mode"], "r") !== \false && \strpos($meta["mode"], "+") === \false) {
throw new \Error("Expected a writable stream");
}
\stream_set_blocking($stream, \false);
\stream_set_write_buffer($stream, 0);
$this->resource = $stream;
$this->chunkSize =& $chunkSize;
$writes = $this->writes = new \SplQueue();
$writable =& $this->writable;
$resource =& $this->resource;
$this->watcher = Loop::onWritable($stream, static function ($watcher, $stream) use($writes, &$chunkSize, &$writable, &$resource) {
static $emptyWrites = 0;
try {
while (!$writes->isEmpty()) {
/** @var Deferred $deferred */
list($data, $previous, $deferred) = $writes->shift();
$length = \strlen($data);
if ($length === 0) {
$deferred->resolve(0);
continue;
}
if (!\is_resource($stream) || ($metaData = @\stream_get_meta_data($stream)) && $metaData['eof']) {
throw new ClosedException("The stream was closed by the peer");
}
// Error reporting suppressed since fwrite() emits E_WARNING if the pipe is broken or the buffer is full.
// Use conditional, because PHP doesn't like getting null passed
if ($chunkSize) {
$written = @\fwrite($stream, $data, $chunkSize);
} else {
$written = @\fwrite($stream, $data);
}
\assert(
$written !== \false || \PHP_VERSION_ID >= 70400,
// PHP 7.4+ returns false on EPIPE.
"Trying to write on a previously fclose()'d resource. Do NOT manually fclose() resources the still referenced in the loop."
);
// PHP 7.4.0 and 7.4.1 may return false on EAGAIN.
if ($written === \false && \PHP_VERSION_ID >= 70402) {
$message = "Failed to write to stream";
if ($error = \error_get_last()) {
$message .= \sprintf("; %s", $error["message"]);
}
throw new StreamException($message);
}
// Broken pipes between processes on macOS/FreeBSD do not detect EOF properly.
if ($written === 0 || $written === \false) {
if ($emptyWrites++ > self::MAX_CONSECUTIVE_EMPTY_WRITES) {
$message = "Failed to write to stream after multiple attempts";
if ($error = \error_get_last()) {
$message .= \sprintf("; %s", $error["message"]);
}
throw new StreamException($message);
}
$writes->unshift([$data, $previous, $deferred]);
return;
}
$emptyWrites = 0;
if ($length > $written) {
$data = \substr($data, $written);
$writes->unshift([$data, $written + $previous, $deferred]);
return;
}
$deferred->resolve($written + $previous);
}
} catch (\Throwable $exception) {
$resource = null;
$writable = \false;
/** @psalm-suppress PossiblyUndefinedVariable */
$deferred->fail($exception);
while (!$writes->isEmpty()) {
list(, , $deferred) = $writes->shift();
$deferred->fail($exception);
}
Loop::cancel($watcher);
} finally {
if ($writes->isEmpty()) {
Loop::disable($watcher);
}
}
});
Loop::disable($this->watcher);
}
/**
* Writes data to the stream.
*
* @param string $data Bytes to write.
*
* @return Promise Succeeds once the data has been successfully written to the stream.
*
* @throws ClosedException If the stream has already been closed.
*/
public function write(string $data) : Promise
{
return $this->send($data, \false);
}
/**
* Closes the stream after all pending writes have been completed. Optionally writes a final data chunk before.
*
* @param string $finalData Bytes to write.
*
* @return Promise Succeeds once the data has been successfully written to the stream.
*
* @throws ClosedException If the stream has already been closed.
*/
public function end(string $finalData = "") : Promise
{
return $this->send($finalData, \true);
}
private function send(string $data, bool $end = \false) : Promise
{
if (!$this->writable) {
return new Failure(new ClosedException("The stream is not writable"));
}
$length = \strlen($data);
$written = 0;
if ($end) {
$this->writable = \false;
}
if ($this->writes->isEmpty()) {
if ($length === 0) {
if ($end) {
$this->close();
}
return new Success(0);
}
if (!\is_resource($this->resource) || ($metaData = @\stream_get_meta_data($this->resource)) && $metaData['eof']) {
return new Failure(new ClosedException("The stream was closed by the peer"));
}
// Error reporting suppressed since fwrite() emits E_WARNING if the pipe is broken or the buffer is full.
// Use conditional, because PHP doesn't like getting null passed.
if ($this->chunkSize) {
$written = @\fwrite($this->resource, $data, $this->chunkSize);
} else {
$written = @\fwrite($this->resource, $data);
}
\assert(
$written !== \false || \PHP_VERSION_ID >= 70400,
// PHP 7.4+ returns false on EPIPE.
"Trying to write on a previously fclose()'d resource. Do NOT manually fclose() resources the still referenced in the loop."
);
// PHP 7.4.0 and 7.4.1 may return false on EAGAIN.
if ($written === \false && \PHP_VERSION_ID >= 70402) {
$message = "Failed to write to stream";
if ($error = \error_get_last()) {
$message .= \sprintf("; %s", $error["message"]);
}
return new Failure(new StreamException($message));
}
$written = (int) $written;
// Cast potential false to 0.
if ($length === $written) {
if ($end) {
$this->close();
}
return new Success($written);
}
$data = \substr($data, $written);
}
$deferred = new Deferred();
if ($length - $written > self::LARGE_CHUNK_SIZE) {
$chunks = \str_split($data, self::LARGE_CHUNK_SIZE);
$data = \array_pop($chunks);
foreach ($chunks as $chunk) {
$this->writes->push([$chunk, $written, new Deferred()]);
$written += self::LARGE_CHUNK_SIZE;
}
}
$this->writes->push([$data, $written, $deferred]);
Loop::enable($this->watcher);
$promise = $deferred->promise();
if ($end) {
$promise->onResolve([$this, "close"]);
}
return $promise;
}
/**
* Closes the stream forcefully. Multiple `close()` calls are ignored.
*
* @return void
*/
public function close()
{
if (\is_resource($this->resource)) {
// Error suppression, as resource might already be closed
$meta = @\stream_get_meta_data($this->resource);
if ($meta && \strpos($meta["mode"], "+") !== \false) {
@\stream_socket_shutdown($this->resource, \STREAM_SHUT_WR);
} else {
/** @psalm-suppress InvalidPropertyAssignmentValue psalm reports this as closed-resource */
@\fclose($this->resource);
}
}
$this->free();
}
/**
* Nulls reference to resource, marks stream unwritable, and fails any pending write.
*
* @return void
*/
private function free()
{
$this->resource = null;
$this->writable = \false;
if (!$this->writes->isEmpty()) {
$exception = new ClosedException("The socket was closed before writing completed");
do {
/** @var Deferred $deferred */
list(, , $deferred) = $this->writes->shift();
$deferred->fail($exception);
} while (!$this->writes->isEmpty());
}
Loop::cancel($this->watcher);
}
/**
* @return resource|null Stream resource or null if end() has been called or the stream closed.
*/
public function getResource()
{
return $this->resource;
}
/**
* @return void
*/
public function setChunkSize(int $chunkSize)
{
$this->chunkSize = $chunkSize;
}
public function __destruct()
{
if ($this->resource !== null) {
$this->free();
}
}
}

@@ -0,0 +1,7 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
class StreamException extends \Exception
{
}

@@ -0,0 +1,96 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
use function WP_Ultimo\Dependencies\Amp\call;
/**
* Allows decompression of input streams using Zlib.
*/
final class ZlibInputStream implements InputStream
{
/** @var InputStream|null */
private $source;
/** @var int */
private $encoding;
/** @var array */
private $options;
/** @var resource|null */
private $resource;
/**
* @param InputStream $source Input stream to read compressed data from.
* @param int $encoding Compression algorithm used, see `inflate_init()`.
* @param array $options Algorithm options, see `inflate_init()`.
*
* @throws StreamException
* @throws \Error
*
* @see http://php.net/manual/en/function.inflate-init.php
*/
public function __construct(InputStream $source, int $encoding, array $options = [])
{
$this->source = $source;
$this->encoding = $encoding;
$this->options = $options;
$this->resource = @\inflate_init($encoding, $options);
if ($this->resource === \false) {
throw new StreamException("Failed initializing deflate context");
}
}
/** @inheritdoc */
public function read() : Promise
{
return call(function () {
if ($this->resource === null) {
return null;
}
\assert($this->source !== null);
$data = (yield $this->source->read());
// Needs a double guard, as stream might have been closed while reading
/** @psalm-suppress ParadoxicalCondition */
if ($this->resource === null) {
return null;
}
if ($data === null) {
$decompressed = @\inflate_add($this->resource, "", \ZLIB_FINISH);
if ($decompressed === \false) {
throw new StreamException("Failed adding data to deflate context");
}
$this->close();
return $decompressed;
}
$decompressed = @\inflate_add($this->resource, $data, \ZLIB_SYNC_FLUSH);
if ($decompressed === \false) {
throw new StreamException("Failed adding data to deflate context");
}
return $decompressed;
});
}
/**
* @internal
* @return void
*/
private function close()
{
$this->resource = null;
$this->source = null;
}
/**
* Gets the used compression encoding.
*
* @return int Encoding specified on construction time.
*/
public function getEncoding() : int
{
return $this->encoding;
}
/**
* Gets the used compression options.
*
* @return array Options array passed on construction time.
*/
public function getOptions() : array
{
return $this->options;
}
}

@@ -0,0 +1,101 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Promise;
/**
* Allows compression of output streams using Zlib.
*/
final class ZlibOutputStream implements OutputStream
{
/** @var OutputStream|null */
private $destination;
/** @var int */
private $encoding;
/** @var array */
private $options;
/** @var resource|null */
private $resource;
/**
* @param OutputStream $destination Output stream to write the compressed data to.
* @param int $encoding Compression encoding to use, see `deflate_init()`.
* @param array $options Compression options to use, see `deflate_init()`.
*
* @throws StreamException If an invalid encoding or invalid options have been passed.
*
* @see http://php.net/manual/en/function.deflate-init.php
*/
public function __construct(OutputStream $destination, int $encoding, array $options = [])
{
$this->destination = $destination;
$this->encoding = $encoding;
$this->options = $options;
$this->resource = @\deflate_init($encoding, $options);
if ($this->resource === \false) {
throw new StreamException("Failed initializing deflate context");
}
}
/** @inheritdoc */
public function write(string $data) : Promise
{
if ($this->resource === null) {
throw new ClosedException("The stream has already been closed");
}
\assert($this->destination !== null);
$compressed = \deflate_add($this->resource, $data, \ZLIB_SYNC_FLUSH);
if ($compressed === \false) {
throw new StreamException("Failed adding data to deflate context");
}
$promise = $this->destination->write($compressed);
$promise->onResolve(function ($error) {
if ($error) {
$this->close();
}
});
return $promise;
}
/** @inheritdoc */
public function end(string $finalData = "") : Promise
{
if ($this->resource === null) {
throw new ClosedException("The stream has already been closed");
}
\assert($this->destination !== null);
$compressed = \deflate_add($this->resource, $finalData, \ZLIB_FINISH);
if ($compressed === \false) {
throw new StreamException("Failed adding data to deflate context");
}
$promise = $this->destination->end($compressed);
$promise->onResolve(function () {
$this->close();
});
return $promise;
}
/**
* @internal
* @return void
*/
private function close()
{
$this->resource = null;
$this->destination = null;
}
/**
* Gets the used compression encoding.
*
* @return int Encoding specified on construction time.
*/
public function getEncoding() : int
{
return $this->encoding;
}
/**
* Gets the used compression options.
*
* @return array Options array passed on construction time.
*/
public function getOptions() : array
{
return $this->options;
}
}

@@ -0,0 +1,154 @@
<?php
namespace WP_Ultimo\Dependencies\Amp\ByteStream;
use WP_Ultimo\Dependencies\Amp\Iterator;
use WP_Ultimo\Dependencies\Amp\Loop;
use WP_Ultimo\Dependencies\Amp\Producer;
use WP_Ultimo\Dependencies\Amp\Promise;
use function WP_Ultimo\Dependencies\Amp\call;
// @codeCoverageIgnoreStart
if (\strlen('…') !== 3) {
throw new \Error('The mbstring.func_overload ini setting is enabled. It must be disabled to use the stream package.');
}
// @codeCoverageIgnoreEnd
if (!\defined('STDOUT')) {
\define('STDOUT', \fopen('php://stdout', 'w'));
}
if (!\defined('STDERR')) {
\define('STDERR', \fopen('php://stderr', 'w'));
}
/**
* @param \Amp\ByteStream\InputStream $source
* @param \Amp\ByteStream\OutputStream $destination
*
* @return \Amp\Promise
*/
function pipe(InputStream $source, OutputStream $destination) : Promise
{
return call(function () use($source, $destination) : \Generator {
$written = 0;
while (($chunk = (yield $source->read())) !== null) {
$written += \strlen($chunk);
$writePromise = $destination->write($chunk);
$chunk = null;
// free memory
(yield $writePromise);
}
return $written;
});
}
/**
* @param \Amp\ByteStream\InputStream $source
*
* @return \Amp\Promise
*/
function buffer(InputStream $source) : Promise
{
return call(function () use($source) : \Generator {
$buffer = "";
while (($chunk = (yield $source->read())) !== null) {
$buffer .= $chunk;
$chunk = null;
// free memory
}
return $buffer;
});
}
/**
* The php://input input buffer stream for the process associated with the currently active event loop.
*
* @return ResourceInputStream
*/
function getInputBufferStream() : ResourceInputStream
{
static $key = InputStream::class . '\\input';
$stream = Loop::getState($key);
if (!$stream) {
$stream = new ResourceInputStream(\fopen('php://input', 'rb'));
Loop::setState($key, $stream);
}
return $stream;
}
/**
* The php://output output buffer stream for the process associated with the currently active event loop.
*
* @return ResourceOutputStream
*/
function getOutputBufferStream() : ResourceOutputStream
{
static $key = OutputStream::class . '\\output';
$stream = Loop::getState($key);
if (!$stream) {
$stream = new ResourceOutputStream(\fopen('php://output', 'wb'));
Loop::setState($key, $stream);
}
return $stream;
}
/**
* The STDIN stream for the process associated with the currently active event loop.
*
* @return ResourceInputStream
*/
function getStdin() : ResourceInputStream
{
static $key = InputStream::class . '\\stdin';
$stream = Loop::getState($key);
if (!$stream) {
$stream = new ResourceInputStream(\STDIN);
Loop::setState($key, $stream);
}
return $stream;
}
/**
* The STDOUT stream for the process associated with the currently active event loop.
*
* @return ResourceOutputStream
*/
function getStdout() : ResourceOutputStream
{
static $key = OutputStream::class . '\\stdout';
$stream = Loop::getState($key);
if (!$stream) {
$stream = new ResourceOutputStream(\STDOUT);
Loop::setState($key, $stream);
}
return $stream;
}
/**
* The STDERR stream for the process associated with the currently active event loop.
*
* @return ResourceOutputStream
*/
function getStderr() : ResourceOutputStream
{
static $key = OutputStream::class . '\\stderr';
$stream = Loop::getState($key);
if (!$stream) {
$stream = new ResourceOutputStream(\STDERR);
Loop::setState($key, $stream);
}
return $stream;
}
function parseLineDelimitedJson(InputStream $stream, bool $assoc = \false, int $depth = 512, int $options = 0) : Iterator
{
return new Producer(static function (callable $emit) use($stream, $assoc, $depth, $options) {
$reader = new LineReader($stream);
while (null !== ($line = (yield $reader->readLine()))) {
$line = \trim($line);
if ($line === '') {
continue;
}
/** @noinspection PhpComposerExtensionStubsInspection */
$data = \json_decode($line, $assoc, $depth, $options);
/** @noinspection PhpComposerExtensionStubsInspection */
$error = \json_last_error();
/** @noinspection PhpComposerExtensionStubsInspection */
if ($error !== \JSON_ERROR_NONE) {
/** @noinspection PhpComposerExtensionStubsInspection */
throw new StreamException('Failed to parse JSON: ' . \json_last_error_msg(), $error);
}
(yield $emit($data));
}
});
}

@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<psalm
totallyTyped="false"
errorLevel="2"
phpVersion="7.0"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="examples"/>
<directory name="lib"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<StringIncrement>
<errorLevel type="suppress">
<directory name="examples"/>
<directory name="lib"/>
</errorLevel>
</StringIncrement>
<RedundantConditionGivenDocblockType>
<errorLevel type="suppress">
<directory name="lib"/>
</errorLevel>
</RedundantConditionGivenDocblockType>
<DocblockTypeContradiction>
<errorLevel type="suppress">
<directory name="lib"/>
</errorLevel>
</DocblockTypeContradiction>
<MissingClosureParamType>
<errorLevel type="suppress">
<directory name="examples"/>
<directory name="lib"/>
</errorLevel>
</MissingClosureParamType>
<MissingClosureReturnType>
<errorLevel type="suppress">
<directory name="examples"/>
<directory name="lib"/>
</errorLevel>
</MissingClosureReturnType>
</issueHandlers>
</psalm>